+ Reply to Thread
Results 1 to 2 of 2

Thread: Problem uploading large files to database

  1. #1
    Junior Member
    Join Date
    May 2012

    Problem uploading large files to database

    I got a database and i`d like to upload large files to it , however i tried that code :
            protected void Button1_Click(object sender, EventArgs e)
                String filename = "", filetype = "", filesize = "";
                if (FileUpload1.HasFile)
                    UploadLogic bl=new UploadLogic();
                    filename = FileUpload1.PostedFile.FileName;
                    filesize = FileUpload1.PostedFile.ContentLength.ToString();
                    filetype = FileUpload1.PostedFile.ContentType;
                    byte[] filepath = new byte[FileUpload1.PostedFile.ContentLength];
                    FileUpload1.PostedFile.InputStream.Read(filepath, 0, FileUpload1.PostedFile.ContentLength);
                    int i = bl.upload_file(filename, filesize, filetype, filepath);
                    DataSet ds = new DataSet();
                    ds = bl.uploaded_Content();
                    ListBox1.DataSource = ds;
                    ListBox1.DataTextField = "File_Name";
                    ListBox1.DataValueField = "File_Name";
                    //Bind data
    But it works only with files less than 1MB , i don`t know where the problem exist actually.
    The code seem to be normal and error free , but i`d really appreciate your help.

  2. #2
    Junior Member
    Join Date
    Jan 2012
    You need to edit your web.config
        <httpRuntime maxRequestLength="SIZE" />
    By default it will be set to 4096kb

+ Reply to Thread

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts