ببخشید دوستان که سوالم بی روبط به موضوع هست از این بابت منو ببخشید.
میخواستم بدونم چطور با شئ inputfile عمل اپلود فایل رو انجام میدید؟
if (this.PicFile.PostedFile.ContentLength > 300 * 1024)
{
this.lblsize.Visible = true;
return;
}
if (this.PicFile.PostedFile.FileName == "")
return;
string FileName = this.PicFile.PostedFile.FileName;
System.IO.FileInfo FI = new System.IO.FileInfo(FileName);
if (FI.Extension.ToLower() != ".jpg")
{
this.lblsuffix.Visible = true;
return;
}
string Path = this.Request.PhysicalApplicationPath;
System.IO.FileStream FS = new System.IO.FileStream(Path + "Images\\" + FI.Name, System.IO.FileMode.Create);
System.IO.Stream St = this.PicFile.PostedFile.InputStream;
byte[] b = new byte[St.Length];
St.Read(b, 0, b.Length);
FS.Write(b, 0, b.Length);
St.Close();
FS.Close();