Upload file with C#
public static void Upload(System.Web.UI.HtmlControls.HtmlInputFile input, string caminho)
{
HttpPostedFile f = input.PostedFile;
string path;
byte[] bts = new byte[f.ContentLength];
f.InputStream.Read(bts, 0, bts.Length);
path = caminho;
FileStream fs = new FileStream(path, FileMode.Create);
fs.Write(bts, 0, bts.Length);
fs.Close();
}
Advertisement
No trackbacks yet.