473,323 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

File Content.Length

Hi everyone,

I'm having a problem when trying to stream a file into a database.
If the file size is below 4mb, then the web upload works fine.
However, if the file size exceeds 4mb, then the page simply errors (an IIS
error with no helpful info.)

The line I'm believing to be the problem is below:

"HttpPostedFile myFile = filMyFile.PostedFile;
nFileLen = myFile.ContentLength;"

From this I am unable to determine the file size for error checking/size
limits etc..
I have attempted to place a catch on this, but that is also ignored.

Is there is limitation on the file length that you can upload via asp.net c#
web applications?
PLEASE HELP!!!

Cheers
Fronky
Nov 19 '05 #1
2 6089
4 megs is the maxium request length by default. You can change this in your
web.config by specifying a maxRequestLength, in KB, in your HttpRuntime of
the system.web:

2megs:
<httpRuntime maxRequestLength="8192" />

Check out:
http://support.microsoft.com/default...22120121120120

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Fronky" <no****@nospam.com> wrote in message
news:et**************@TK2MSFTNGP14.phx.gbl...
Hi everyone,

I'm having a problem when trying to stream a file into a database.
If the file size is below 4mb, then the web upload works fine.
However, if the file size exceeds 4mb, then the page simply errors (an IIS
error with no helpful info.)

The line I'm believing to be the problem is below:

"HttpPostedFile myFile = filMyFile.PostedFile;
nFileLen = myFile.ContentLength;"

From this I am unable to determine the file size for error checking/size
limits etc..
I have attempted to place a catch on this, but that is also ignored.

Is there is limitation on the file length that you can upload via asp.net
c#
web applications?
PLEASE HELP!!!

Cheers
Fronky

Nov 19 '05 #2
Hi Karl,

Your a genius! Thanks for that. It now works a treat.

Thanks Again
Fronky
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:uv**************@TK2MSFTNGP10.phx.gbl...
4 megs is the maxium request length by default. You can change this in your web.config by specifying a maxRequestLength, in KB, in your HttpRuntime of
the system.web:

2megs:
<httpRuntime maxRequestLength="8192" />

Check out:
http://support.microsoft.com/default...22120121120120
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Fronky" <no****@nospam.com> wrote in message
news:et**************@TK2MSFTNGP14.phx.gbl...
Hi everyone,

I'm having a problem when trying to stream a file into a database.
If the file size is below 4mb, then the web upload works fine.
However, if the file size exceeds 4mb, then the page simply errors (an IIS error with no helpful info.)

The line I'm believing to be the problem is below:

"HttpPostedFile myFile = filMyFile.PostedFile;
nFileLen = myFile.ContentLength;"

From this I am unable to determine the file size for error checking/size
limits etc..
I have attempted to place a catch on this, but that is also ignored.

Is there is limitation on the file length that you can upload via asp.net c#
web applications?
PLEASE HELP!!!

Cheers
Fronky


Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Christian Galbavy | last post by:
Hello! My friend and I are working on a little program. It sends a local file to a server (php), we use the rfc1867 protocoll for this. When the server gets the data, it replies with some...
10
by: mike | last post by:
regards: I use Jtidy (api) to translate a HTML file into a "XHTML file". But The "XHTML file" cannot be identified by nokia 6600. Do I miss something important? Or this is Jtidy's weakness or...
8
by: lawrence | last post by:
Under the domain publicpen.com I've several dozen sites in subdiretories, such as www.publicpen.com/honenbeger. I've no trouble with any of these sites. But under one, which I put in yesterday,...
6
by: Bryan Martin | last post by:
Ok im trying to figure out how internet explorers file download box always seem to at least come close to knowing the exact file size/time to download. From what I can tell its getting its not...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
6
by: john | last post by:
The standard method to transmit a file from an aspx page to a browser is to stream the file to the response then end the response. The HTML code generated by the aspx page is discarded, and the...
4
by: Natalia | last post by:
Hello, I need to provide the ability to post file and some form elements via our website (asp.net) to the third party website (asp page). On http://aspalliance.com/236#Page4 - I found great...
2
by: Michael D. Ober | last post by:
When I single step through the code below, it sends back the PDF file that is retrieved in the line fm.GetAccountPDF(...). When I run without single stepping, I get the master page for this page. ...
1
by: shyaminf | last post by:
hi everybody! iam facing a problem with the transfer of file using servlet programming. i have a code for uploading a file. but i'm unable to execute it using tomcat5.5 server. kindly help me how to...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.