Fileupload problem with files larger than 1MB

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.
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top