473,657 Members | 2,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Large File Upload Probelm...

Can someone please tell me why I keep getting an error saying the page cannot
be displayed in my ASP.NET app. If I upload a file that is under approx 3mb
then it works file but as soon as I try to upload a larger file I get

Page Cannot be displayed error...

I'm uploading the file as binary into and SQL 2000 Database!

Any advice would be appritiated!

Thanks

CODE::..
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here

phBody.Controls .Add(New LiteralControl( "<body bottomMargin=" &
Chr(34) & "0" & Chr(34) & "leftMargin =" & Chr(34) & "0" & Chr(34) &
"topMargin= " & Chr(34) & "0" & Chr(34) & "rightMargi n=" & Chr(34) & "0" &
Chr(34) & "runat=" & Chr(34) & "server" & Chr(34) & ">"))

'Loads user controls
Dim c1 As Control = LoadControl("../userControls/footer.ascx")
phFooter.Contro ls.Add(c1)
Dim c2 As Control = LoadControl("../userControls/headerMenu.ascx ")
phHeaderMenu.Co ntrols.Add(c2)
Dim c3 As Control = LoadControl("../userControls/Header.ascx")
phHeader.Contro ls.Add(c3)
Dim c4 As Control = LoadControl("../userControls/QuickLinks.ascx ")
phQuickLinks.Co ntrols.Add(c4)

populateDDL()
UserDetails()

If Page.IsPostBack Then

' user submitted file to be uploaded
' create URL with query string to confirm file upload
' next page will not be a postback, so viewstate will be lost
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Tr ue"

If Request.Browser .Browser = "IE" Then
phBody.Controls .Clear()
phBody.Controls .Add(New LiteralControl( "<body onload=" &
Chr(34) & "loadTarget (" & Chr(39) & sRefreshURL & Chr(39) & ")" & Chr(59) &
Chr(34) & " bottomMargin=" & Chr(34) & "0" & Chr(34) & " leftMargin=" &
Chr(34) & "0" & Chr(34) & " topMargin=" & Chr(34) & "0" & Chr(34) & "
rightMargin=" & Chr(34) & "0" & Chr(34) & " runat=" & Chr(34) & "server" &
Chr(34) & ">"))

' set META REFRESH as well in case script is disabled
' use long delay so that script can load page first if
possible
phRefresh.Contr ols.Clear()
phRefresh.Contr ols.Add(New LiteralControl( "<meta
http-equiv=" & Chr(34) & "refresh" & Chr(34) & " content=" & Chr(34) &
"30;url=" & sRefreshURL & Chr(34) & ">"))
Else

' not IE so use META REFRESH to start loading next page
' allow 3 seconds for progress bar image to load

phRefresh.Contr ols.Clear()
phRefresh.Contr ols.Add(New LiteralControl( "<meta
http-equiv=" & Chr(34) & "Refresh" & Chr(34) & " content=" & Chr(34) &
"3;url=" & sRefreshURL & Chr(34) & ">"))

End If

' hide Upload file controls and show "wait" section
pnlUploadFile.V isible = False
pnlWait.Visible = True
UploadData()

Else

' get query string
Dim iUpload As String = Request.QuerySt ring("Upload")

If iUpload = "" Then

pnlUploadFile.V isible = True

Else
pnlUploadFile.V isible = False
pnlResults.Visi ble = True
lblResults.Text = "Your file has been succesfully uploaded..."

End If
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Fa lse"

End If

End Sub
Sub UploadData()
Dim imgstream As Stream = ImageFile.Poste dFile.InputStre am
Dim imgdata(ImageFi le.PostedFile.C ontentLength) As Byte
imgstream.Read( imgdata, 0, ImageFile.Poste dFile.ContentLe ngth)

Dim MyConn As New
SqlConnection(C onfigurationSet tings.AppSettin gs("strConn"))
Dim cmd As New SqlCommand("fil eUpload", MyConn)
cmd.CommandType = CommandType.Sto redProcedure

Dim titleparam As New SqlParameter("@ fileTitle", SqlDbType.NVarC har,
255)
Dim descriptionpara m As New SqlParameter("@ fileDescription ",
SqlDbType.NVarC har, 255)
Dim Ownerparam As New SqlParameter("@ fileOwner", SqlDbType.NVarC har,
255)
Dim Officeparam As New SqlParameter("@ officeID", SqlDbType.Int)
Dim typeparam As New SqlParameter("@ fileType", SqlDbType.NVarC har,
100)
Dim dataparam As New SqlParameter("@ fileData", SqlDbType.Image )

titleparam.Valu e = ImageTitle.Text
descriptionpara m.Value = fldDescription. Text
Ownerparam.Valu e = fldOwner.Text
Officeparam.Val ue = ddlOffice.Selec tedIndex
typeparam.Value = ImageFile.Poste dFile.ContentTy pe
dataparam.Value = imgdata

cmd.Parameters. Add(titleparam)
cmd.Parameters. Add(description param)
cmd.Parameters. Add(Ownerparam)
cmd.Parameters. Add(Officeparam )
cmd.Parameters. Add(typeparam)
cmd.Parameters. Add(dataparam)

MyConn.Open()
cmd.ExecuteNonQ uery()
MyConn.Close()
End Sub
Nov 19 '05 #1
2 1845
This is likely :
http://support.microsoft.com/default...en-us;323246#7 ("Upload
Larger Files")

Patrice

--

"Tim::.." <myatix_at_hotm ail.com> a écrit dans le message de
news:9A******** *************** ***********@mic rosoft.com...
Can someone please tell me why I keep getting an error saying the page cannot be displayed in my ASP.NET app. If I upload a file that is under approx 3mb then it works file but as soon as I try to upload a larger file I get

Page Cannot be displayed error...

I'm uploading the file as binary into and SQL 2000 Database!

Any advice would be appritiated!

Thanks

CODE::..
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here

phBody.Controls .Add(New LiteralControl( "<body bottomMargin=" &
Chr(34) & "0" & Chr(34) & "leftMargin =" & Chr(34) & "0" & Chr(34) &
"topMargin= " & Chr(34) & "0" & Chr(34) & "rightMargi n=" & Chr(34) & "0" &
Chr(34) & "runat=" & Chr(34) & "server" & Chr(34) & ">"))

'Loads user controls
Dim c1 As Control = LoadControl("../userControls/footer.ascx")
phFooter.Contro ls.Add(c1)
Dim c2 As Control = LoadControl("../userControls/headerMenu.ascx ")
phHeaderMenu.Co ntrols.Add(c2)
Dim c3 As Control = LoadControl("../userControls/Header.ascx")
phHeader.Contro ls.Add(c3)
Dim c4 As Control = LoadControl("../userControls/QuickLinks.ascx ")
phQuickLinks.Co ntrols.Add(c4)

populateDDL()
UserDetails()

If Page.IsPostBack Then

' user submitted file to be uploaded
' create URL with query string to confirm file upload
' next page will not be a postback, so viewstate will be lost
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Tr ue"

If Request.Browser .Browser = "IE" Then
phBody.Controls .Clear()
phBody.Controls .Add(New LiteralControl( "<body onload=" &
Chr(34) & "loadTarget (" & Chr(39) & sRefreshURL & Chr(39) & ")" & Chr(59) & Chr(34) & " bottomMargin=" & Chr(34) & "0" & Chr(34) & " leftMargin=" &
Chr(34) & "0" & Chr(34) & " topMargin=" & Chr(34) & "0" & Chr(34) & "
rightMargin=" & Chr(34) & "0" & Chr(34) & " runat=" & Chr(34) & "server" &
Chr(34) & ">"))

' set META REFRESH as well in case script is disabled
' use long delay so that script can load page first if
possible
phRefresh.Contr ols.Clear()
phRefresh.Contr ols.Add(New LiteralControl( "<meta
http-equiv=" & Chr(34) & "refresh" & Chr(34) & " content=" & Chr(34) &
"30;url=" & sRefreshURL & Chr(34) & ">"))
Else

' not IE so use META REFRESH to start loading next page
' allow 3 seconds for progress bar image to load

phRefresh.Contr ols.Clear()
phRefresh.Contr ols.Add(New LiteralControl( "<meta
http-equiv=" & Chr(34) & "Refresh" & Chr(34) & " content=" & Chr(34) &
"3;url=" & sRefreshURL & Chr(34) & ">"))

End If

' hide Upload file controls and show "wait" section
pnlUploadFile.V isible = False
pnlWait.Visible = True
UploadData()

Else

' get query string
Dim iUpload As String = Request.QuerySt ring("Upload")

If iUpload = "" Then

pnlUploadFile.V isible = True

Else
pnlUploadFile.V isible = False
pnlResults.Visi ble = True
lblResults.Text = "Your file has been succesfully uploaded..."
End If
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Fa lse"

End If

End Sub
Sub UploadData()
Dim imgstream As Stream = ImageFile.Poste dFile.InputStre am
Dim imgdata(ImageFi le.PostedFile.C ontentLength) As Byte
imgstream.Read( imgdata, 0, ImageFile.Poste dFile.ContentLe ngth)

Dim MyConn As New
SqlConnection(C onfigurationSet tings.AppSettin gs("strConn"))
Dim cmd As New SqlCommand("fil eUpload", MyConn)
cmd.CommandType = CommandType.Sto redProcedure

Dim titleparam As New SqlParameter("@ fileTitle", SqlDbType.NVarC har, 255)
Dim descriptionpara m As New SqlParameter("@ fileDescription ",
SqlDbType.NVarC har, 255)
Dim Ownerparam As New SqlParameter("@ fileOwner", SqlDbType.NVarC har, 255)
Dim Officeparam As New SqlParameter("@ officeID", SqlDbType.Int)
Dim typeparam As New SqlParameter("@ fileType", SqlDbType.NVarC har,
100)
Dim dataparam As New SqlParameter("@ fileData", SqlDbType.Image )

titleparam.Valu e = ImageTitle.Text
descriptionpara m.Value = fldDescription. Text
Ownerparam.Valu e = fldOwner.Text
Officeparam.Val ue = ddlOffice.Selec tedIndex
typeparam.Value = ImageFile.Poste dFile.ContentTy pe
dataparam.Value = imgdata

cmd.Parameters. Add(titleparam)
cmd.Parameters. Add(description param)
cmd.Parameters. Add(Ownerparam)
cmd.Parameters. Add(Officeparam )
cmd.Parameters. Add(typeparam)
cmd.Parameters. Add(dataparam)

MyConn.Open()
cmd.ExecuteNonQ uery()
MyConn.Close()
End Sub

Nov 19 '05 #2
Thank you!!!

"Patrice" wrote:
This is likely :
http://support.microsoft.com/default...en-us;323246#7 ("Upload
Larger Files")

Patrice

--

"Tim::.." <myatix_at_hotm ail.com> a écrit dans le message de
news:9A******** *************** ***********@mic rosoft.com...
Can someone please tell me why I keep getting an error saying the page

cannot
be displayed in my ASP.NET app. If I upload a file that is under approx

3mb
then it works file but as soon as I try to upload a larger file I get

Page Cannot be displayed error...

I'm uploading the file as binary into and SQL 2000 Database!

Any advice would be appritiated!

Thanks

CODE::..
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here

phBody.Controls .Add(New LiteralControl( "<body bottomMargin=" &
Chr(34) & "0" & Chr(34) & "leftMargin =" & Chr(34) & "0" & Chr(34) &
"topMargin= " & Chr(34) & "0" & Chr(34) & "rightMargi n=" & Chr(34) & "0" &
Chr(34) & "runat=" & Chr(34) & "server" & Chr(34) & ">"))

'Loads user controls
Dim c1 As Control = LoadControl("../userControls/footer.ascx")
phFooter.Contro ls.Add(c1)
Dim c2 As Control = LoadControl("../userControls/headerMenu.ascx ")
phHeaderMenu.Co ntrols.Add(c2)
Dim c3 As Control = LoadControl("../userControls/Header.ascx")
phHeader.Contro ls.Add(c3)
Dim c4 As Control = LoadControl("../userControls/QuickLinks.ascx ")
phQuickLinks.Co ntrols.Add(c4)

populateDDL()
UserDetails()

If Page.IsPostBack Then

' user submitted file to be uploaded
' create URL with query string to confirm file upload
' next page will not be a postback, so viewstate will be lost
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Tr ue"

If Request.Browser .Browser = "IE" Then
phBody.Controls .Clear()
phBody.Controls .Add(New LiteralControl( "<body onload=" &
Chr(34) & "loadTarget (" & Chr(39) & sRefreshURL & Chr(39) & ")" & Chr(59)

&
Chr(34) & " bottomMargin=" & Chr(34) & "0" & Chr(34) & " leftMargin=" &
Chr(34) & "0" & Chr(34) & " topMargin=" & Chr(34) & "0" & Chr(34) & "
rightMargin=" & Chr(34) & "0" & Chr(34) & " runat=" & Chr(34) & "server" &
Chr(34) & ">"))

' set META REFRESH as well in case script is disabled
' use long delay so that script can load page first if
possible
phRefresh.Contr ols.Clear()
phRefresh.Contr ols.Add(New LiteralControl( "<meta
http-equiv=" & Chr(34) & "refresh" & Chr(34) & " content=" & Chr(34) &
"30;url=" & sRefreshURL & Chr(34) & ">"))
Else

' not IE so use META REFRESH to start loading next page
' allow 3 seconds for progress bar image to load

phRefresh.Contr ols.Clear()
phRefresh.Contr ols.Add(New LiteralControl( "<meta
http-equiv=" & Chr(34) & "Refresh" & Chr(34) & " content=" & Chr(34) &
"3;url=" & sRefreshURL & Chr(34) & ">"))

End If

' hide Upload file controls and show "wait" section
pnlUploadFile.V isible = False
pnlWait.Visible = True
UploadData()

Else

' get query string
Dim iUpload As String = Request.QuerySt ring("Upload")

If iUpload = "" Then

pnlUploadFile.V isible = True

Else
pnlUploadFile.V isible = False
pnlResults.Visi ble = True
lblResults.Text = "Your file has been succesfully

uploaded..."

End If
Dim sRefreshURL As String = Request.Url.ToS tring() &
"?Upload=Fa lse"

End If

End Sub
Sub UploadData()
Dim imgstream As Stream = ImageFile.Poste dFile.InputStre am
Dim imgdata(ImageFi le.PostedFile.C ontentLength) As Byte
imgstream.Read( imgdata, 0, ImageFile.Poste dFile.ContentLe ngth)

Dim MyConn As New
SqlConnection(C onfigurationSet tings.AppSettin gs("strConn"))
Dim cmd As New SqlCommand("fil eUpload", MyConn)
cmd.CommandType = CommandType.Sto redProcedure

Dim titleparam As New SqlParameter("@ fileTitle",

SqlDbType.NVarC har,
255)
Dim descriptionpara m As New SqlParameter("@ fileDescription ",
SqlDbType.NVarC har, 255)
Dim Ownerparam As New SqlParameter("@ fileOwner",

SqlDbType.NVarC har,
255)
Dim Officeparam As New SqlParameter("@ officeID", SqlDbType.Int)
Dim typeparam As New SqlParameter("@ fileType", SqlDbType.NVarC har,
100)
Dim dataparam As New SqlParameter("@ fileData", SqlDbType.Image )

titleparam.Valu e = ImageTitle.Text
descriptionpara m.Value = fldDescription. Text
Ownerparam.Valu e = fldOwner.Text
Officeparam.Val ue = ddlOffice.Selec tedIndex
typeparam.Value = ImageFile.Poste dFile.ContentTy pe
dataparam.Value = imgdata

cmd.Parameters. Add(titleparam)
cmd.Parameters. Add(description param)
cmd.Parameters. Add(Ownerparam)
cmd.Parameters. Add(Officeparam )
cmd.Parameters. Add(typeparam)
cmd.Parameters. Add(dataparam)

MyConn.Open()
cmd.ExecuteNonQ uery()
MyConn.Close()
End Sub


Nov 19 '05 #3

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

Similar topics

0
3110
by: Marc | last post by:
Hello, I have a page where i can upload binary file (using the HTML input type=file approach). This works fine for relatively small files (<6MB)) but when files get bigger (13MB) there is a problem. The code of the php file is based upon the article in http://www.onlamp.com/pub/a/php/2000/09/15/php_mysql.html: uploading large binary files using more than one table and more trhan 1 row per file.
2
2450
by: Tim | last post by:
I meet problem on uploading a file with a large file size. Below is my code, how can I modify in order to be able to upload a large file successfully ? Thank for your help. upload.html: <html> <body><br><br><center> <form action="upload.php" method=post enctype="multipart/form-data"> File upload: <input type=file name="userfile"> <input type=submit value="send"><br> </form>
6
4834
by: Thomas Due | last post by:
Hi, I am writing an ASP.NET project where I allow users to upload files to the server. I have changed to web.config to allow a total file size of 100MB. My problem is that if the total file size exceed this amount the page simply stops works, and I get a "Server unreachable" error. Is there any way to handle this, so I am able to present the user with a nice error message telling him that the maximum file size has been exceeded.
1
1590
by: Ron Vecchi | last post by:
When posting a file upload I have taken in consideration the maxRequestLength and set it accordingly. In my case where a posibility of a 30 meg file can be uploaded I set it to 30720. Although its hard to test since I'm developing locally I am a little worried about the time it might take to post this 30 mb file if the person is on dialup. (worst case scenario) Is there anything that would timeout on me. I have looked into...
1
2878
by: Nawaz Ijaz | last post by:
Hi All, Just need to know that how can it be possible to upload large file in chunks of bytes. Suppose i have a large file (100 MB) and i want to upload it in chunks (say 20 KB). How can this be done as "Simple html File Upload Control" upload file in one go. That i not want really, I want to upload it to the server from my aspx page in parts/chunks. regards, Nawaz Ijaz.
6
3609
by: Paul | last post by:
Hi there, When adding a "File Field" HTML control to an aspx page to facilitate file uploading, the following occurs: 1. You select a file that is larger than the allowed size limit. 2. Once the user selected the too large file, the page is redirected to a "page not found" error page. 3. This is as per the docs, but my question is:
1
1883
by: Fred Herring | last post by:
I have a client/server application which uses webservices functions to upload large byte arrays to the server and httpwebrequests to download the data files. I would like to use http to also upload but am lost in how to implement this. basic information: My Url looks like this "http://144.115.108.xxx/webservice1/myvirtual/videofiles/" I want to be able to upload a large binary file to my server called
16
4971
by: lawrence k | last post by:
I've a file upload script on my site. I just now used it to upload a small text document (10k). Everything worked fine. Then I tried to upload a 5.3 meg Quicktime video. Didn't work. I've set the POST limit in php.ini to 8 megs. What reasons, other than the POST limit, would a large upload fail?
6
4860
by: howa | last post by:
Suppose the file is stored in "upload_tmp_dir ", so why I need to increase the memory limit? If I want to upload 100 MB, how large should I set? Thanks.
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.