简体   繁体   中英

Asp.net - Create a custom File Upload Control from scratch

I have tried using the FileUpload control in ASP.net and found some strange problems. I have decided to scrap this control and create a custom control. Is it possible to create a file upload control from scratch?

thanks

AsyncFileUpload is an ASP.NET AJAX Control that allows you asynchronously upload files to server. The file uploading results can be checked both in the server and client sides. You can save the uploaded file by calling the SaveAs() method in a handler for the server UploadedComplete event.

Check out this: http://www.asp.net/ajax/ajaxcontroltoolkit/samples/AsyncFileUpload/AsyncFileUpload.aspx

Yes, it's possible. Essentially your control will just have to render an input tag with a type of file, eg:

protected override void Render(HtmlTextWriter output)
{       
   output.Write("<input type='file' />");   
}

However, this is a gross simplification of the problem...!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM