Uploading Large data

  • Thread starter Thread starter Husam
  • Start date Start date
H

Husam

Hi Every Body:

I have the following code that work fine with me when I load data thier size
just 5 mb but when I move for 10mb or 20mb or 100mb it did not work with me?

My code is:

Dim arrayImage() As Byte = FileUpload1.FileBytes
TextBox1.Text = FileUpload1.FileName
Dim nStr As String =
Me.TextBox1.Text.Substring(Me.TextBox1.Text.LastIndexOf("\") + 1)
Dim scon As SqlConnection = New
SqlConnection(ConfigurationManager.ConnectionStrings("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()

Can Some body help in Uploading data more than 10mb or 20mb or even more
than 100 mb?

any help or redirection will be appreciated

regard's

Husam
 
The cause of the problem may well be this line of code:
Dim arrayImage() As Byte = FileUpload1.FileBytes

Which puts the whole file content into server memory at once and may
be causing resource problems epsecially if the site is using shared
hosting.
 
Back
Top