<code> Jag tittade inte så noga efter fel i koden(för invecklad), men har du kollat så att du har skrivrättigheter till mappen dit filerna ska?Fel vid upload
<%@EnableSessionState=True%>
<%Response.Buffer=True%>
<%Response.Expires=0
Server.ScriptTimeout = 900000
UPLOAD_PATH = Server.MapPath("pics")
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Set Folder = Fso.getFolder(UPLOAD_PATH)
If (Request.ServerVariables("REQUEST_METHOD") = "POST") Then
y = request.form("y")
do until y < 1
Set Upload = get_upload_files()
fcontent = Upload("upload" & y).Item("content")
allow = ".gif,.jpg,.GIF,.JPG"
extension = right(extract_filename(Upload("upload" & y).Item("filename")),4)
If FS.FileExists(Files_upload & "\" & extract_filename(Upload("upload" & y).Item("filename"))) Then
Session("upload") = "Det finns redan en fil med det namnet, byt namn på filen !!!"
Response.Redirect "upload.asp"
Else
If instr(allow,extension) then
Set File = FS.CreateTextFile(Files_upload & "\" & extract_filename(Upload("upload" & y).Item("filename")))
Else
Session("upload") = "Filen är ej godkänd<br>Endast <b>" & allow & "</b> är godkända."
Response.Redirect "upload.asp"
End If
End If
For i = 1 to LenB(fcontent)
File.Write chr(AscB(MidB(fcontent, i, 1)))
Next
File.Close: Set File = Nothing
Session("file") = extract_filename(Upload("upload" & y).Item("filename"))
Response.Redirect "upload.asp?do=skicka"
y = y - 1
loop
End If%>
<%=Session("upload")%>
<%
Function get_upload_files()
Set upload_object = Server.CreateObject("Scripting.Dictionary")
request_binaries = Request.BinaryRead(Request.TotalBytes)
position_start = 1
position_end = InstrB(position_start, request_binaries, get_byte_string(chr(13)))
boundary = MidB(request_binaries, position_start, (position_end - position_start))
boundary_pos = InstrB(1, request_binaries, boundary)
Do Until (boundary_pos = InstrB(request_binaries, boundary & get_byte_string("--")))
If Not(Response.IsClientConnected) Then Response.End
position_start = (InstrB(InstrB(boundary_pos, request_binaries, get_byte_string("Content-Disposition")), request_binaries, get_byte_string("name=")) + 6)
position_end = InstrB(position_start, request_binaries, get_byte_string(chr(34)))
name = get_string(MidB(request_binaries, position_start, (position_end - position_start)))
pos_file = InstrB(boundary_pos, request_binaries, get_byte_string("filename="))
If ((pos_file <> 0) AND (pos_file < InstrB(position_end, request_binaries, boundary))) Then
upload_object.Add name, Server.CreateObject("Scripting.Dictionary")
position_start = (pos_file + 10)
position_end = InstrB(position_start, request_binaries, get_byte_string(chr(34)))
upload_object.item(name).Add "filename", get_string(MidB(request_binaries, position_start, (position_end - position_start)))
position_start = (InstrB(position_end, request_binaries, get_byte_string("Content-Type:")) + 14)
position_end = InstrB(position_start, request_binaries, get_byte_string(chr(13)))
upload_object.item(name).Add "content-type", get_string(MidB(request_binaries, position_start, (position_end - position_start)))
position_start = (position_end + 4)
position_end = InstrB(position_start, request_binaries, boundary) - 2
upload_object.item(name).Add "size", ((position_end - position_start))
upload_object.item(name).Add "content", MidB(request_binaries, position_start, (position_end - position_start))
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)
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)
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
%></code>
Det blir bara vitt och filen laddas ej upp.. innan jag fipplade lite med det fick ajg fel på raden:
Function get_upload_files()Sv: Fel vid upload