Zelthor
12-19-2007, 07:08 AM
Hey guys,
I have a problem with uploading a JPEG-file to my webpage.
All the other file-types, like .txt, .doc, .xls and .pdf work but for some reason it keeps returning an error when I try to upload a .jpg-file.
This is the code I'm using:
' Check if any files were uploaded
If Uploader.Files.Count = 0 THEN
'doe niks
Else
' Loop through the uploaded files
For Each Files In Uploader.Files.Items
if Files.FileSize < 3000000 then
if Files.ContentType = "application/msword" then
Files.FileName = Request.QueryString("mnr")&".doc"
' Save the file
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "application/vnd.ms-excel" then
Files.FileName = Request.QueryString("mnr")&".xls"
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "text/plain" then
Files.FileName = Request.QueryString("mnr")&".txt"
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "application/pdf" then
Files.FileName = Request.QueryString("mnr")&".pdf"
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "image/jpeg" then
Files.FileName = Request.QueryString("mnr")&".jpg"
Files.SaveToDisk meldingsregistratieuploadpad
else
fout = "TRUE"
Response.write "alert('Alleen Word documenten toegestaan.');"
end if
else
fout = "TRUE"
Response.write "alert('Bestand mag maximum 3MB bevatten.');"
end if
Next
End if
if fout = "FALSE" then
Response.Redirect("bekijkuploadpage.asp?mnr="&Request.QueryString("mnr"))
else
Response.write "window.location='bekijkuploadpage.asp?mnr="&Request.QueryString("mnr")&"';"
end if
I also tried using gif instead of jpeg: that worked just fine.
Can anyone help me?
Thanx
I have a problem with uploading a JPEG-file to my webpage.
All the other file-types, like .txt, .doc, .xls and .pdf work but for some reason it keeps returning an error when I try to upload a .jpg-file.
This is the code I'm using:
' Check if any files were uploaded
If Uploader.Files.Count = 0 THEN
'doe niks
Else
' Loop through the uploaded files
For Each Files In Uploader.Files.Items
if Files.FileSize < 3000000 then
if Files.ContentType = "application/msword" then
Files.FileName = Request.QueryString("mnr")&".doc"
' Save the file
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "application/vnd.ms-excel" then
Files.FileName = Request.QueryString("mnr")&".xls"
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "text/plain" then
Files.FileName = Request.QueryString("mnr")&".txt"
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "application/pdf" then
Files.FileName = Request.QueryString("mnr")&".pdf"
Files.SaveToDisk meldingsregistratieuploadpad
elseif Files.ContentType = "image/jpeg" then
Files.FileName = Request.QueryString("mnr")&".jpg"
Files.SaveToDisk meldingsregistratieuploadpad
else
fout = "TRUE"
Response.write "alert('Alleen Word documenten toegestaan.');"
end if
else
fout = "TRUE"
Response.write "alert('Bestand mag maximum 3MB bevatten.');"
end if
Next
End if
if fout = "FALSE" then
Response.Redirect("bekijkuploadpage.asp?mnr="&Request.QueryString("mnr"))
else
Response.write "window.location='bekijkuploadpage.asp?mnr="&Request.QueryString("mnr")&"';"
end if
I also tried using gif instead of jpeg: that worked just fine.
Can anyone help me?
Thanx