Odd File Upload Experience

G

Guest

I am using the html input type=file to upload files to the webserver. This is working fine, but only for files less than ~3mb in size. When I attempt to upload a file >3mb, i immediatley receive a standard error "page cannot be displayed, cannot find server or dns error". Very odd indeed. In looking through the logs, I see my request and it appears to be logging a HTTP 400 (Bad Request). I believe this to be a problem related to asp.net or the size of the post (viewstate, etc) - just an assumption. In trying this from Mozilla Firefox browser, it does give me an immediate popup error "document cotains no data". Recall, this code does work, but only for smaller files.

If someone could try this out to see if they can send files >3mb to their webserver, please let me know.

Following is the webform code:
<form id="ccgImport" method="post" encType="multipart/form-data" runat="server">
<input id="File1" title="Select File To Upload!" maxlength="9999999" type="file" size="27" name="File1" runat="server">
<asp:button id="cmdUpload" runat="server" Height="25px" Width="90px" Text="Upload"></asp:button>
<asp:label id="lblMessage" runat="server" Height="25px" Width="300px" Font-Bold="True" ForeColor="Red"></asp:label>
</form>

Following is the code behind (placed in the cmdUpload's OnClick Event):
File1.PostedFile.SaveAs(c:\foldername\file.txt])


Perhaps I have to use a more robust upload method, but not sure why this worlks for files <3mb than errors so oddly for larger files. This one has me stumped!!

Thanks in advance!
 
G

Greg Burns

http://support.microsoft.com/default.aspx?scid=kb;[LN];295626

Add to your web.config:

<system.web>
<!-- maxsize for uploaded file 100MB KB #295626 -->
<httpRuntime maxRequestLength="102400"/>

</system.web>

HTH,
Greg

Chris Fink said:
I am using the html input type=file to upload files to the webserver.
This is working fine, but only for files less than ~3mb in size. When I
attempt to upload a file >3mb, i immediatley receive a standard error "page
cannot be displayed, cannot find server or dns error". Very odd indeed. In
looking through the logs, I see my request and it appears to be logging a
HTTP 400 (Bad Request). I believe this to be a problem related to asp.net
or the size of the post (viewstate, etc) - just an assumption. In trying
this from Mozilla Firefox browser, it does give me an immediate popup error
"document cotains no data". Recall, this code does work, but only for
smaller files.
If someone could try this out to see if they can send files >3mb to their webserver, please let me know.

Following is the webform code:
<form id="ccgImport" method="post" encType="multipart/form-data" runat="server">
<input id="File1" title="Select File To Upload!" maxlength="9999999"
type="file" size="27" name="File1" runat="server">
<asp:button id="cmdUpload" runat="server" Height="25px" Width="90px"
Text="Upload"> said:
<asp:label id="lblMessage" runat="server" Height="25px" Width="300px"
Font-Bold="True" ForeColor="Red"> said:
</form>

Following is the code behind (placed in the cmdUpload's OnClick Event):
File1.PostedFile.SaveAs(c:\foldername\file.txt])


Perhaps I have to use a more robust upload method, but not sure why this
worlks for files <3mb than errors so oddly for larger files. This one has
me stumped!!
 

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

Top