开发者

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

开发者 https://www.devze.com 2023-02-21 01:28 出处:网络
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 开发者_StackOverflow中

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 开发者_StackOverflow中文版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, e.g.:

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号