Fileupload problem with files larger than 1MB

Discussion in 'ASP .Net' started by grimBeast, Aug 27, 2003.

  1. grimBeast

    grimBeast Guest

    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.
     
    grimBeast, Aug 27, 2003
    #1
    1. Advertising

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

    "grimBeast" <> wrote in message
    news:...
    > 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.
     
    Kevin Spencer, Aug 27, 2003
    #2
    1. Advertising

  3. do you have more than one machine.config?

    "Christian Bennich" <> wrote in message
    news:...
    > Hi Kevin
    >
    > Thanks for your reply.
    >
    > I have tried all of your suggestions, but still nothing works.
    >
    > It seems that ASP.NET partly doesn't care about the values that I put in
    > either the web.config or the machine.config.
    >
    > If I set maxRequestLength=10 then it behaves almost correcly. Now I
    > can't upload a small 120K file, but I still get the DNS error. As soon
    > as I adjust the maxRequestLength to more than 1000 then it fucks up, and
    > I can only upload files below 1000K - NOT GOOD :-(
    >
    > Any other help would be greatly appriciated.
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    MS News \(MS ILM\), Aug 27, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9yZ2UgUmliZWlybw==?=

    Uploading files larger than 4Mb

    =?Utf-8?B?Sm9yZ2UgUmliZWlybw==?=, Feb 18, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    534
    Gopal \(FMS, Inc.\)
    Feb 18, 2005
  2. Peter Williams
    Replies:
    1
    Views:
    1,424
    Dylan Parry
    Jun 3, 2005
  3. shwetu
    Replies:
    0
    Views:
    379
    shwetu
    Dec 18, 2006
  4. Robert Kochem

    iostream and files larger than 4GB

    Robert Kochem, Jul 21, 2008, in forum: C++
    Replies:
    16
    Views:
    1,022
    James Kanze
    Jul 23, 2008
  5. texasreddog
    Replies:
    3
    Views:
    114
    Peter Wyzl
    May 16, 2007
Loading...

Share This Page