Dim g_oFso, g_oFolder, g_oFile Set g_oFso = Server.CreateObject("Scripting.FileSystemObject") Set g_oFolder = g_oFso.getFolder(UPLOAD_PATH)
If (Request.ServerVariables("REQUEST_METHOD") = "POST") Then Dim g_oUpload Set g_oUpload = get_upload_files()
Dim fpos, fcontent fcontent = g_oUpload("upload").Item("content") Set g_oFile = g_oFso.CreateTextFile(UPLOAD_PATH & "\" & extract_filename(g_oUpload("upload").Item("filename"))) For fpos = 1 to LenB(fcontent) g_oFile.Write chr(AscB(MidB(fcontent, fpos, 1))) Next g_oFile.Close: Set g_oFile = Nothing
Response.Redirect Request.ServerVariables("SCRIPT_NAME") End If
If ((pos_file <> 0) AND (pos_file < InstrB(position_end, request_binaries, boundary))) Then upload_object.Add name, Server.CreateObject("Scripting.Dictionary")
Dim g_oFso, g_oFolder, g_oFile Set g_oFso = Server.CreateObject("Scripting.FileSystemObject") Set g_oFolder = g_oFso.getFolder(UPLOAD_PATH)
If (Request.ServerVariables("REQUEST_METHOD") = "POST") Then Dim g_oUpload Set g_oUpload = get_upload_files()
Dim fpos, fcontent fcontent = g_oUpload("upload").Item("content") Set g_oFile = g_oFso.CreateTextFile(UPLOAD_PATH & "\" & extract_filename(g_oUpload("upload").Item("filename"))) For fpos = 1 to LenB(fcontent) g_oFile.Write chr(AscB(MidB(fcontent, fpos, 1))) Next g_oFile.Close: Set g_oFile = Nothing response.write("Billedet er blevet uploadet korrekt") 'denne linie skal ændres hvis det skal ændres... Eller der skal mere til.. response.end Response.Redirect Request.ServerVariables("SCRIPT_NAME")
If ((pos_file <> 0) AND (pos_file < InstrB(position_end, request_binaries, boundary))) Then upload_object.Add name, Server.CreateObject("Scripting.Dictionary")
End If boundary_pos = InstrB(boundary_pos + LenB(boundary), request_binaries, boundary) Loop
Set get_upload_files = upload_object
End Function
Function get_byte_string(str) Dim cnt For cnt = 1 to Len(str) get_byte_string = get_byte_string & chrB(AscB(Mid(str, cnt, 1))) Next End Function
Function get_string(str) Dim cnt For cnt = 1 to LenB(str) get_string = get_string & chr(AscB(MidB(str, cnt, 1))) Next End Function
Function extract_filename(filename) extract_filename = Right(filename, Len(filename) - InStrRev(filename, "\", -1, 1)) End Function %>
Sådan her...
Dette virker hos mig, du kan ændre den linie jeg har skrevet ved. Du kan evt. Slette response.end på linien efter, derved får du skrevet Billedet... osv. over rækken af filer, og over formen til upload af flere filer...
/Ellebæk
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.