Fileupload problem with files larger than 1MB

  • Thread starter Thread starter grimBeast
  • Start date Start date
G

grimBeast

Hi

I have a problem with the uploading of files larger than 1MB.

My upload code look like this:

If Not fUpload.PostedFile Is Nothing And
fUpload.PostedFile.ContentLength > 0 Then
fn = Path.GetFileName(fUpload.PostedFile.FileName)
SaveLocation = Server.MapPath("hjplusupload") + "\" + fn

Try
fUpload.PostedFile.SaveAs(SaveLocation)
lblMessages.Text = "The file has been uploaded to: " &
SaveLocation
Catch ex As Exception
lblMessages.Text = "Error: " + ex.Message
End Try
Else
lblMessages.Text = "Please enter a file to upload."
End If

And I have added the following to my web.config:
<httpRuntime executionTimeout="3600" maxRequestLength="10000" />

However when I try to upload files above 1MB the server just returns a
standard IIS "Cannot Find Server - page cannot be displayed" error -
no error from .NET.

I have tried adjusting the maxRequestLength - but nothing seems to
work.
The server is a Win2K.
 
The first thing you need to do is to enable IE to give you the actual error
message:

Tools|Internet Options|Advanced - uncheck "Show Friendly HTTP Error
messages"

That should help you with future error messages.

Second, you need to make the same change in your machine.config file that
you made in the web.config file. The settings in the machine.config file
override any application-specific settings.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.
 
Back
Top