Reputation: 308
protected void Button1_Click(object sender, EventArgs e)
{
//Uploading file from Computer to Database(server)
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 your Data
ListBox1.DataBind();
}
}
This code uploads only file which is less than 1MB. If i want to upload huge files its not happening. Can any one tell me Why?
Upvotes: 0
Views: 1278
Reputation: 14470
Have a look at httpRuntime
You need to edit your web.config
<configuration>
<system.web>
<httpRuntime maxRequestLength="SIZE" />
</system.web>
</configuration>
By default it will be set to 4096kb
Anyway, if the file size is reasonably high it will be be a good solution to upload the file into database.
Upvotes: 1
Reputation:
Edit your web.config
<httpRuntime useFullyQualifiedRedirectUrl="true|false"
maxRequestLength="size in kbytes"
executionTimeout="seconds"
minFreeThreads="number of threads"
minFreeLocalRequestFreeThreads="number of threads"
appRequestQueueLimit="number of requests"
versionHeader="version string"/>
Source Element
Upvotes: 1