file upload, large file upload.

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

A new asp. The net page, into the FileUpload upload controls in the toolbar. A button Button  !    !


Enter the Button event //-------------------------------------------------------------------------

string path = FileUpload1.PostedFile.FileName;

//Gets the path of uploading files

string Name = path.Substring(path.LastIndexOf("\\") + 1);   //Get file name

string Size = Convert.ToString(FileUpload1.PostedFile.ContentLength);

//Get file size

string Extend = path.Substring(path.LastIndexOf(".") + 1);  //Gets the file extension

string Type = FileUpload1.PostedFile.ContentType;

//Gets the file type

string serverPath = Server.MapPath(@"Create a new file, the file name\") + Name;

//The path to save the server


//Determine the upload

So you can upload the file to the specified file.

But the above file upload size for the specified 4MB, if you want to upload more files to the Web.config configuration files to add a statement:

//------------------------------ added configuration -------------------------------------------------


<httpRuntime executionTimeout="3600" maxRequestLength="1048576"/>


So you can upload large files to the server.

Beginners can have a look around, loudly.. What is the message the comments and questions...............

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Bowen at November 16, 2013 - 10:04 AM