asp.net non-refresh attachment Upload Implementation Method _ Practical skills

Source: Internet
Author: User

Recent reference to some information on the Web, initially reached the expected target (client access to upload progress, not found any good method, no implementation), the use of IFRAME to achieve the attachment of no refresh upload effect (in fact there are submitted IFRAME), in order to use convenient, and finally made,. NET user-defined control:

Control Use Examples:

Control page Effect just "add attachment" picture, run effect chart one:

Click on the picture pop-up file selection box, run effect figure two

Select File Open, file start upload, click the " Stop" button, "uploading" into "waiting to upload", "Stop" into "upload", the operation effect figure three

The upload failed because the size of the attachment is limited or page access timed out, and the effect figure four

button buttons are server buttons that can be added to the JS validation function for a duration:

BUTTON1.ATTRIBUTES.ADD ("onclick", "return Checkfilestate ();");

Run effect Figure five:

Delete Upload failed file, run effect Figure VI:

After submission, you can get to upload the name of the successful attachment in the CS, in the FILEUP.ASHX is the time to rename the file, in order to avoid duplication can be added after a few random number.

Run Effect Figure VII:

In the CS file:

Copy Code code as follows:

public partial class _default:system.web.ui.page
{
protected void Page_Load (object sender, EventArgs e)
{
BUTTON1.ATTRIBUTES.ADD ("onclick", "return Checkfilestate ();");
}
protected void Button1_Click (object sender, EventArgs e)
{
Response.Write (Filepostctr1.value);
}
}

Code package download

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.