så här ser min kod ut ... vart stoppar jag in din kod för att få döpt filen direkt när folk laddar upp den?
Eller måste filen först upp på servern och sedan måste man slussa användaren till ytterligare en sida för att köra din kod?
<%
' Author Philippe Collignon
Response.Expires=0
Response.Buffer = TRUE
Response.Clear
'Response.BinaryWrite(Request.BinaryRead(Request.TotalBytes))
byteCount = Request.TotalBytes
'Response.BinaryWrite(Request.BinaryRead(varByteCount))
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
username = UploadRequest.Item("username").Item("Value")
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
value = UploadRequest.Item("blob").Item("Value")
'Create FileSytemObject Component
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
'Kollar om det är jpg eller gif fil om det stämmer, gå vidare
if contentType="image/pjpeg" or contentType="image/gif" then
'Kollar nu med strMaxSize om den är större än 150kb, om inte, gå vidare
if byteCount \> 150000 then
response.write "\<br\>\<br\>\<p align=center\>\<font face=Verdana size=2 color=red\>\<b\>Bilden är för stor, "& byteCount &" bytes.\<br\>Den får max vara 150000 bytes (150 Kb).\</b\>\</font\>\</p\>"
else
'Create and Write to a File
pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&"faces\bild"&filename)
For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value,i,1)))
Next
MyFile.Close
......här fortsätter sidan och avslutas med ett formulär som uppdaterar användarens bildId i databasen