<asp:FileUpload ID="filUpload" runat="server" />
<asp:Button ID="cmdUpload" runat="server" OnClick="cmdUpload_Click" Text="Upload" />
protected void cmdUpload_Click(object sender, EventArgs e)
{
if (filUpload.PostedFile != null && filUpload.PostedFile.ContentLength > 0)
{
byte[] bData = new byte[filUpload.PostedFile.ContentLength];
filUpload.PostedFile.InputStream.Read(bData, 0, filUpload.PostedFile.ContentLength);
//Retrieve filename
System.IO.FileInfo oInfo = new System.IO.FileInfo(filUpload.PostedFile.FileName);
}
}
Back to ASP.NET