ASP. NET Ajax asyncfileupload control usage
Time:
Source:Unknown
Author:Admin
Click:254 times
I want to contribute
High-quality ASP. NET space, perfect support for 1.0/2.0/3.5/MVC, etc.
The asyncfileupload control is used to asynchronously upload files. For example, refer to: Upload. If you need to upload files asynchronously, refer to the following usage: Front-end code: <Ajaxtoolkit: asyncfileupload onclientuploaderror = "uploaderror" onclientuploadcomplete = "uploadcomplete" Runat = "server" id = "asyncfileupload1" width = "400px" uploaderstyle = "modern" Uploadingbackcolor = "# ccffff" Onuploadedcomplete = "asyncfileupload1_uploadedcomplete"/> Let's talk about attributes, Onclientuploaderror: client Error Handling Method Onclientuploadcomplete: client upload completion event Uploaderstyle: control style, either traditional or modern Onuploadedcomplete: Specifies the storage location and name of a file by calling the saveas method. Front-end JS Code: Function uploadcomplete (sender, argS ){ Alert ("uploaded successfully "); }Function uploaderror (sender, argS ){ Alert ("Upload error "); } Background code: Protected void asyncfileupload1_uploadedcomplete (Object sender, ajaxcontroltoolkit. asyncfileuploadeventargs E) { Ajaxcontroltoolkit. asyncfileupload fileuploader = sender as ajaxcontroltoolkit. asyncfileupload; If (fileuploader! = NULL & fileuploader. hasfile) { Fileuploader. saveas (server. mappath ("/resource/uploadfile/" + fileuploader. filename )); } } |