473,387 Members | 1,493 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,387 software developers and data experts.

How to upload big file to DB with webpage?

Hello,

I want to upload the file by webpage to SQL Server.

When I upload the small file, it is work.
But, when I upload big file(ex. 40~50 MB), it isn't work;
the Browser displays the following error message:
"The webpage consulted at present is unable to use.
Websites may happen the technological question or you need to adjust the
browser to establish ."

I test it,
reading file to byte array is ok, but import byte array to DB is error.
I add "Connect Timeout=300", it still has this error.

What do this error mean?
And how to solve it?

Thanks for your help.

Nov 16 '05 #1
5 4734
Uploads done through an HTTP POST are subject to the maximum request size.
In most cases this is 4096 k (4 megs).

If you have control over the server you can change the MaxRequestSize
setting in machine.config. if not you'll have to collaborate with whoever
runs the server to create a page that enables you to send chunks of a file
in smaller portions.

If it's not a POST issue then I don't know what to suggest.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Grace" <Gr***@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
Hello,

I want to upload the file by webpage to SQL Server.

When I upload the small file, it is work.
But, when I upload big file(ex. 40~50 MB), it isn't work;
the Browser displays the following error message:
"The webpage consulted at present is unable to use.
Websites may happen the technological question or you need to adjust the
browser to establish ."

I test it,
reading file to byte array is ok, but import byte array to DB is error.
I add "Connect Timeout=300", it still has this error.

What do this error mean?
And how to solve it?

Thanks for your help.

Nov 16 '05 #2
This problem can be due to two different cause:
1. Your file is not fully being uploaded.
2. Your logic to update database server is taking too long.
Let me address prblem number one. Solution for this problem lies in
web.config file. Add following section:

<httpRuntime
maxRequestLength="40000"
executionTimeout="1800"
/>

maxRequestLength is request size in kb and executionTimeout is in seconds.
Hope this makes sence to you.
To find out if the problem is of second type, you divide your process into
two. First only try to upload the file, if it is successful, that means your
database update logic is taking long. If this is the case, post your
database update logic here, we will optimize it.

-Praveen
Nov 16 '05 #3
Hi,
Put this in your web.config

<httpRuntime maxRequestLength="100000" ></httpRuntime>

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Grace" <Gr***@discussions.microsoft.com> wrote in message
news:40**********************************@microsof t.com...
Hello,

I want to upload the file by webpage to SQL Server.

When I upload the small file, it is work.
But, when I upload big file(ex. 40~50 MB), it isn't work;
the Browser displays the following error message:
"The webpage consulted at present is unable to use.
Websites may happen the technological question or you need to adjust the
browser to establish ."

I test it,
reading file to byte array is ok, but import byte array to DB is error.
I add "Connect Timeout=300", it still has this error.

What do this error mean?
And how to solve it?

Thanks for your help.

Nov 16 '05 #4
Thanks.
I think Server's RAM seems to be larger.
But, when the RAM is 1GB, it still can't save bigger file into SQL Server.
I test that it only upload about 4xMB file into SQL Server.

Does it use the memory of the Web Server when user upload the file?
Does it use the memory of the Web Server when the uploaded the file( in the
memory(byte array) ) saves into DB?

Thanks again.

"Praveen" wrote:
Web form is not going to wait for 40mb byte[] load to complete. This method
is going to have very bad performance result when multiple users accessing
different services on your server. I suggest a logic change than a technical
solution. Divide the process into two.
1. Upload the file, using your present method, to a pre-defined folder on
the server.
2. Write a separate program to load all the files on that folder to the
database server and delete them.
According to your requirement, (ie, how fast you need the data on the
database)
a. run this program as scheduled task (may be at night)
b. or run it as a server service, using FileSystemWatcher on that folder,
to load files as they arrive.

If you need the user to be notified how successful the upload were, may be
you can collect the email address of the user and send status emails from
your upload program.

I suggest this program to be run from a separate computer considering amount
of memory it will require.

-Praveen

Nov 16 '05 #5
for a short period, untill SaveAs() method finish its work. After that when
you load the data to byte array, it is again stored on server memory.
Having seen your question on the news group, I decided to post my past
experiance of solving a smilar problem in uploading file. Only difference is
that my file was MS Access (.mdb) database file. I have used slightly
different approach here. My server now is receiving upto 20 MB files using
this method. May be my experince help you with more ideas.

http://www.kpraveen.com/uploadMdb2Sql.htm

-Praveen

"Grace" wrote:
Thanks.
I think Server's RAM seems to be larger.
But, when the RAM is 1GB, it still can't save bigger file into SQL Server.
I test that it only upload about 4xMB file into SQL Server.

Does it use the memory of the Web Server when user upload the file?
Does it use the memory of the Web Server when the uploaded the file( in the
memory(byte array) ) saves into DB?

Thanks again.

"Praveen" wrote:
Web form is not going to wait for 40mb byte[] load to complete. This method
is going to have very bad performance result when multiple users accessing
different services on your server. I suggest a logic change than a technical
solution. Divide the process into two.
1. Upload the file, using your present method, to a pre-defined folder on
the server.
2. Write a separate program to load all the files on that folder to the
database server and delete them.
According to your requirement, (ie, how fast you need the data on the
database)
a. run this program as scheduled task (may be at night)
b. or run it as a server service, using FileSystemWatcher on that folder,
to load files as they arrive.

If you need the user to be notified how successful the upload were, may be
you can collect the email address of the user and send status emails from
your upload program.

I suggest this program to be run from a separate computer considering amount
of memory it will require.

-Praveen

Nov 16 '05 #6

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

Similar topics

1
by: lazyadmin | last post by:
I would like to use this code on my website to allow simple file uploads from clients. I would like to restrict the file types they can upload. Can this be done? Any help appreciated. Rod...
4
by: Mattias | last post by:
Hi I am building a simple database system in MS Access 2002 and would like to create a command button that upon clicking transfers the current mdb-file to an ftp-server. Is there a solution for...
2
by: randall g | last post by:
Hello, I have been trying to figure out how to make a VB.NET application program (not a web page) upload a file to a .NET website. File upload from a webpage form is straightforward and works fine,...
8
by: Braky Wacky | last post by:
Hello, I have an ASP.NET webpage that uses an instance of System.Web.UI.HtmlControls.HtmlInputFile for uploading files to our server. I came across the documentation at MSDN for upping the...
5
by: Seok Bee | last post by:
Dear Experts, I currently trying to use the FileUpload control from asp.net 2.0 to upload files. The uploading of the file I would like to store it in the Access Database. Unfortunately, I've no...
1
by: sspost | last post by:
i have a webpage ABC.aspx, where i am browsing for a file , when i get the file that i want to upload D:\document.pdf , i pass this D:\document.pdf to next webpage XYZ.aspx as string, so there is...
0
by: Shanthini Ganesh | last post by:
HI. Any One already fix this following problem? I have to upload a swf banner for my site at runtime. I have tried with FTPwebrequest class. The complete code here.. btnUpload_click() { string...
5
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.