H
Husam
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.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()
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
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.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()
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