Oli: Upload nur mit ASP erstellen

Beitrag lesen

Was haellst du von diesem Quellcode. Laeuft ganz gut nur hat es das Problem das man nur kleine Dateien hohladen kann und bei groesseren haengt sich der Server auf. Kann man das vielleicht irgendwie umgehen??

<html>
<body>
<%
  Dim objFSO
  Dim f
  Dim HdrB
  Dim Hdr
  Dim x
  Dim ini
  Dim Fin
  Dim strFileName
  Dim strFileContent
  Dim fileSize
  Dim fileType

Server.ScriptTimeOut = 86400 '3600 = 1 Minut

HdrB = Request.BinaryRead(Request.TotalBytes)
    Hdr = Null

For x = 1 to LenB(HdrB)
      Hdr = Hdr & Chr(AscB(MidB(HdrB, x, 1)))
    Next

Ini = Instr(1, Hdr, "filename=", 1) + 10
    Fin = Instr(Ini, Hdr, Chr(34), 1) - 1
    Ini = InstrRev(Hdr, "", Fin, 1) + 1
    strFileName = Mid(Hdr, Ini, (Fin - Ini) + 1)

Ini = Instr(1, Hdr, Chr(13) & Chr(10) & Chr(13) & Chr(10), 1) + 4
    Fin = InstrRev(Hdr, Chr(13) & Chr(10) & Chr(45), -1, 1)
    strFileContent = Mid(Hdr, Ini, Fin - Ini)

fileSize = Len(strFileContent) 'This will give you the size of the file that the user wishes to upload.
    fileType = Right(strFileName, 3) 'The value 3 will rip the 3 first characters from the right so you can se the extension (the file type).

Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set f = objFSO.OpenTextFile(Server.MapPath("./") & "\Files" & strFileName, 2, True, 0) 'The filename and other options you wish to use when saving.

f.Write strFileContent 'This line writes the code to your wanted destination file.
    f.Close

Set f = Nothing
  Set objFSO = Nothing
%>
</body>
</html>