By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,621 Members | 1,179 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,621 IT Pros & Developers. It's quick & easy.

Problem with Large data

P: n/a
Hi EveryBody:

I posted the following code two days ago when I face problem that my code
could not upload large data or to be prices more than 4 MB.

The code are :

Dim arrayImage As Byte() = FileUpload1.FileBytes
TextBox1.Text = FileUpload1.FileName
Dim nStr As String =
Me.TextBox1.Text.Substring(Me.TextBox1.Text.LastIn dexOf("\") + 1)
Dim scon As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrin gs("Husam").ConnectionString)
Dim sql As String = "INSERT INTO MyTable(Name,Pic)" +
"VALUES(@Filename,@Picture)"
Dim cmd As New SqlCommand(sql, scon)
With cmd
.Parameters.Add(New SqlParameter("@Filename", SqlDbType.NVarChar,
50)).Value = nStr
.Parameters.Add(New SqlParameter("@Picture", SqlDbType.Image)).Value =
arrayImage
End With
scon.Open()
cmd.ExecuteNonQuery()
scon.Close()

Some body told me may be the problem are with line:

dim arrayimage() as byte=FileUpload1.FileBytes that put the whole file
content into the servermemory one and that may cause resourec problem.

And I may agree with him cause when ever i try use the above code with file
his size more than 4 Mb which is double my cache memory it stop uploading.

So Is there some one can help me in finding such way that can make me upload
large data either by spliting the file into pices and upload each pice alone
or some how?

any help or redirection will be completelly appreciated

regard's

Husam
Feb 22 '08 #1
Share this Question
Share on Google+
1 Reply

P: n/a
In the Web.config file, override the value of maxRequestLength for the
application. For example, the following entry in Web.config allows files that
are less than or equal to 8 megabytes (MB) to be uploaded:
<httpRuntime maxRequestLength="8192" />
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: htp://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"Husam" wrote:
Hi EveryBody:

I posted the following code two days ago when I face problem that my code
could not upload large data or to be prices more than 4 MB.

The code are :

Dim arrayImage As Byte() = FileUpload1.FileBytes
TextBox1.Text = FileUpload1.FileName
Dim nStr As String =
Me.TextBox1.Text.Substring(Me.TextBox1.Text.LastIn dexOf("\") + 1)
Dim scon As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrin gs("Husam").ConnectionString)
Dim sql As String = "INSERT INTO MyTable(Name,Pic)" +
"VALUES(@Filename,@Picture)"
Dim cmd As New SqlCommand(sql, scon)
With cmd
.Parameters.Add(New SqlParameter("@Filename", SqlDbType.NVarChar,
50)).Value = nStr
.Parameters.Add(New SqlParameter("@Picture", SqlDbType.Image)).Value =
arrayImage
End With
scon.Open()
cmd.ExecuteNonQuery()
scon.Close()

Some body told me may be the problem are with line:

dim arrayimage() as byte=FileUpload1.FileBytes that put the whole file
content into the servermemory one and that may cause resourec problem.

And I may agree with him cause when ever i try use the above code with file
his size more than 4 Mb which is double my cache memory it stop uploading.

So Is there some one can help me in finding such way that can make me upload
large data either by spliting the file into pices and upload each pice alone
or some how?

any help or redirection will be completelly appreciated

regard's

Husam
Feb 22 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.