Unable to upload larger files using PostedFile

morghabie

New member
Joined
Jul 11, 2003
Messages
2
This is the "The page cannot be displayed" error when the file is too large. My problem though seems to be more of a timeout issue.

I have set the maxRequestLength="4096" in the web.config, as well as executionTimeout="900". But when I try to upload a file above 900k I still get the above error. Smaller files work fine.
This is on a 640K dsl connection.
I had someone else try to upload a file who had a faster connection (T1) and they were able to upload up to 1.5MB without error.

Im using standard code to upload (see below).

What is going on? Its so simple yet I cannot get it to work.
Thanks,
ADAM


-----------------------------------------------------------------------

<html>
<script language="VB" runat="server">

Sub File_Upload (Sender as Object, e as EventArgs)


Dim strFileName as string
strFileName = MyFile.PostedFile.FileName
Dim myFileName as string = System.IO.Path.GetFileName(strFileName)

Try
MyFile.PostedFile.SaveAs(server.mappath("\jj\pics\") + myFileName)
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
FileSize.InnerHtml = MyFile.PostedFile.ContentLength
ThankYouMessage.Visible = true
catch Exp as exception
ERRORMSG.InnerHtml=Exp.Message
ErrorMessage.Visible = true
End Try

End Sub
</Script>

<body>

<form method="Post" enctype="Multipart/Form-Data" runat="Server">
Choose a file to upload:<br>
<input id="MyFile" type="File" runat="Server" size="25">
<p></p>
<input type="Submit" value="Upload" onserverclick="File_Upload" runat="Server">
<P>

<asp:panel id="ThankYouMessage" runat="server" Visible="False">
Success.<p>
File Name: <span id="FileName" runat="Server"/><br>
File Content: <span id="FileContent" runat="Server"/><br>
File Size: <span id="FileSize" runat="Server"/>bytes<br>
</asp:panel>

<asp:panel id="ErrorMessage" runat="server" Visible="False">
Your File was not sucessfull.<br>
<span id="ERRORMSG" runat="Server"/>
</asp:panel>

</form>
</body>
</html>
 
Maybe this helps:

Change the "machine.config" in the frameworks directory (mine is under (\Windows\Microsoft.net\.........)

<httpRuntime
executionTimeout="90"
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false"
minFreeThreads="8"
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
enableVersionHeader="true"
/>

Change the values you need...

Regards
 
Unfortunately I do not have control over the machine.config. This is on a web server belonging to my web host.
Besides, the web.config is *supposed* to override settings in machine.config.

Thanks,
ADAM
 
It is supposed to, I suggest contacting your host for some info, it is possible that they have it blocked.
 
Back
Top