using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public class uploadFile {
public string uploadFileImage(FileUpload FileUploadName, string NewFileName, string pathImages) {
string fileExt = System.IO.Path.GetExtension(FileUploadName.FileName.ToLower());
string result;
if ((fileExt == ".jpg") || (fileExt == ".jpeg") || (fileExt == ".bmp") || (fileExt == ".gif")){
if (FileUploadName.PostedFile.ContentLength <= 102400){
FileUploadName.SaveAs(HttpContext.Current.Server.MapPath(pathImages) + NewFileName + fileExt);
result = NewFileName + fileExt;
}else{
result = "OverLength";
}
}else{
result = "NotType";
}
return result;
}
}