18. september 2001 - 17:25
												Der er
									2 kommentarer													og
					1 løsning									
									
		 
		
			
ASPupload & filnavne
			Dette her er sikker nemt for nogen, så er der en der kan hjælpe. Jeg sidder og roder med ASP upload og har brug for at kunne trække det rene filnavn ud.
Jeg får f.eks. d:\\www\\website.dk\\http\\log\\11.jpg
Men jeg vil gerne isolerer 11.jpg i en variabel.
/Buzz
					
		
	 
		
								
					
				18. september 2001 - 17:36
				#1
						
		 
		
			<%
Dim ID, objConn, RS, El_billed 
%>
<%
 
 Set Upload = Server.CreateObject(\"Persits.Upload.1\")
 Upload.Save \"e:/stien/images\"
 
\' ++++++++++++++++++++++++++++++++++ HENTER STIEN+FILNAVN ++++++++++++++++++++++++++++++++
 For Each File in Upload.Files
 Filstien = File.Path
 Next
 For Each Item in Upload.Form
 ting = item.value
 Next
\' ++++++++++++++++++++++++++++++++++ HENTER STIEN+FILNAVN SLUT ++++++++++++++++++++++++++++++++
 
\' ++++++++++++++++++++++++++++++++++ FJERN STIEN ++++++++++++++++++++++++++++++++
Function RemoveHTML(strContent)
  Do
    pos = 1
\' +++++++++++++++++++++++ HER SKRIVES \"DREVBOGSTAV :\"
    tmpBegin = InStr(pos,strContent,\"e:\")
\' +++++++++++++++++++++++ HER SKRIVES \"DREVBOGSTAV :\" SLUT
    If tmpBegin > 0 Then
      pos = tmpBegin
\' +++++++++++++++++++++++ HER SKRIVES \"SIDSTE DIR\" OG ANTALLET AF TEGN SKRIVES I NÆSTE LINIE
        tmpEnd = InStr(pos,strContent,\"/images\")
  tmpEnd = tmpEnd + 7
\' +++++++++++++++++++++++ HER SKRIVES \"SIDSTE DIR\" SLUT
        If tmpEnd > 0 Then
          strContent = Left(strContent,tmpBegin-1)  & \"\" & Right(strContent,Len(strContent)-tmpEnd)
        Else
          strContent = Left(strContent,tmpBegin-1)
          Exit Do
        End If
    Else
      Exit Do
    End If
  Loop
  RemoveHTML = strContent
End Function
tmpContent = Trim(Filstien)
Filstienkort = Replace(RemoveHTML(tmpContent), vbCrLf, \"\")
filstienkort = \"\'\" & filstienkort
\' ++++++++++++++++++++++++++++++++++ FJERN STIEN SLUT ++++++++++++++++++++++++++++++++
 
\' ++++++++++++++++++++++++++++++++++ GEMMER SIDSTE STI+FILNAVN ++++++++++++++++++++++++++++++++
 \' Save to the database using the ToDatabase method.
 \' SQL Server table creation script can be found in Database\\CreateTables.sql
 
Set oConn = Server.CreateObject(\"ADODB.Connection\")
oConn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & Server.MapPath(\"../db/database.mdb\")
Set Rs = Server.CreateObject(\"ADODB.Recordset\")
Set Rs.ActiveConnection = oConn
 filstienkort=replace(filstienkort,\"\'\",\"\")
 \'strSQL = \"UPDATE DISTINCTROW tele SET El_billed = \'\"& filstienkort &\"\' WHERE id = \"& ting &\"\"
  strSQL = \"UPDATE DISTINCTROW tele SET El_billed = \'\"& filstienkort &\"\' WHERE id = \"& ting &\"\"
 
\'response.write strsql
set Rs = oConn.Execute(strSQL)
oConn.close
\' ++++++++++++++++++++++++++++++++++ GEMMER SIDSTE STI+FILNAVN SLUT ++++++++++++++++++++++++++++++++
\' ++++++++++++++++++++++++++++++++++++++++++++++++++ OPRETTER I DATABASE
%>
		
		
	 
	
		
								
					
				18. september 2001 - 17:39
				#2
						
		 
		
			hmmm jeg ved ikke lige hvad du skal bruge det til
men prøv om dette kan hjælpe dig
<%
dim dinSti,antalElementer, dinFilNavn
dinSti = \"d:\\www\\website.dk\\http\\log\\11.jpg\"
antalElementer = Ubound(split(dinSti,\"\\\"))
dinFilNavn = split(dinSti,\"\\\")(AntalElementer)
Response.write(dinFilNavn)
%>
Håber det kan hjælpe dig