define an array of input control in aspx.cs
i have an input control of type file.
<input id="FileUpload1" type="file" runat="server" size="35" />
there are four input controls like this and in aspx.cs file i m trying to make an array of these ids..
i have made an array
HtmlInputFile[] fl = new HtmlInputFile[4] { FileUpload1, FileUpload2, FileUpload3, FileUpload4 };
but it g开发者_开发百科ives me an error..how can i get the value of these inputs.
The
FileUploadX.PostedFile
Property is null if no file was uploaded. You need to check wether
FileUploadX.HasFile == true
before attempting to access it.
In case you are using ASP.Net AJAX updatepanels, you'll run into all sorts of proplems with FileUpload. See http://geekswithblogs.net/mmintoff/archive/2009/04/01/fileupload-within-updatepanel.aspx for possible solutions
精彩评论