Problem with Large data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SHVzYW0=?=

    Problem with Large data

    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.Fil eBytes
    TextBox1.Text = FileUpload1.Fil eName
    Dim nStr As String =
    Me.TextBox1.Tex t.Substring(Me. TextBox1.Text.L astIndexOf("\") + 1)
    Dim scon As SqlConnection = New
    SqlConnection(C onfigurationMan ager.Connection Strings("Husam" ).ConnectionStr ing)
    Dim sql As String = "INSERT INTO MyTable(Name,Pi c)" +
    "VALUES(@Filena me,@Picture)"
    Dim cmd As New SqlCommand(sql, scon)
    With cmd
    .Parameters.Add (New SqlParameter("@ Filename", SqlDbType.NVarC har,
    50)).Value = nStr
    .Parameters.Add (New SqlParameter("@ Picture", SqlDbType.Image )).Value =
    arrayImage
    End With
    scon.Open()
    cmd.ExecuteNonQ uery()
    scon.Close()

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

    dim arrayimage() as byte=FileUpload 1.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
  • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

    #2
    RE: Problem with Large data

    In the Web.config file, override the value of maxRequestLengt h 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 maxRequestLengt h="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.Fil eBytes
    TextBox1.Text = FileUpload1.Fil eName
    Dim nStr As String =
    Me.TextBox1.Tex t.Substring(Me. TextBox1.Text.L astIndexOf("\") + 1)
    Dim scon As SqlConnection = New
    SqlConnection(C onfigurationMan ager.Connection Strings("Husam" ).ConnectionStr ing)
    Dim sql As String = "INSERT INTO MyTable(Name,Pi c)" +
    "VALUES(@Filena me,@Picture)"
    Dim cmd As New SqlCommand(sql, scon)
    With cmd
    .Parameters.Add (New SqlParameter("@ Filename", SqlDbType.NVarC har,
    50)).Value = nStr
    .Parameters.Add (New SqlParameter("@ Picture", SqlDbType.Image )).Value =
    arrayImage
    End With
    scon.Open()
    cmd.ExecuteNonQ uery()
    scon.Close()
    >
    Some body told me may be the problem are with line:
    >
    dim arrayimage() as byte=FileUpload 1.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

    Comment

    Working...