string FileName;
FileName = FileUpload1.FileName;
string ExtName;
ExtName = Path.GetExtension(FileName);
if (ExtName != ".jpg")
{
Response.Write("You choose the file dishonestly !!!");
return;
}
if (FileUpload1.PostedFile.ContentLength > 131072)
{
Response.Write("The size of big too file , the size of the file must 128 KB not exceed!!! ");
return;
}
string CurrentPath = Server.MapPath("~/UploadedPath/");
if (FileUpload1.HasFile)
{
CurrentPath += FileName ;
System.IO.FileInfo file = null;
file = new System.IO.FileInfo(FileName);
if (file.Exists)
{
Response.Write("File Already Exist!!!");
return;
}
FileUpload1.SaveAs(CurrentPath);
Response.Write("File Uploaded Sucessfully !!!");
}
else
{
Response.Write("Can not load the file !");
}
FileName = FileUpload1.FileName;
string ExtName;
ExtName = Path.GetExtension(FileName);
if (ExtName != ".jpg")
{
Response.Write("You choose the file dishonestly !!!");
return;
}
if (FileUpload1.PostedFile.ContentLength > 131072)
{
Response.Write("The size of big too file , the size of the file must 128 KB not exceed!!! ");
return;
}
string CurrentPath = Server.MapPath("~/UploadedPath/");
if (FileUpload1.HasFile)
{
CurrentPath += FileName ;
System.IO.FileInfo file = null;
file = new System.IO.FileInfo(FileName);
if (file.Exists)
{
Response.Write("File Already Exist!!!");
return;
}
FileUpload1.SaveAs(CurrentPath);
Response.Write("File Uploaded Sucessfully !!!");
}
else
{
Response.Write("Can not load the file !");
}
No comments:
Post a Comment