if (FileUpload1.PostedFile != null)
{
if (FileUpload1.PostedFile.ContentType == "jpg" || FileUpload1.PostedFile.ContentType == "gif" || FileUpload1.PostedFile.ContentType == "png")
{
if (FileUpload1.PostedFile.ContentLength == 20)
{
string fileName = FileUpload1.FileName;
FileUpload1.SaveAs(@"D:\" + fileName);
Response.Write("File Uploaded");
}
else
{
Response.Write("Image must 20 kb");
}
}
else
{
Response.Write("File must be Image");
}
}
else Response.Write("Please select file to upload");
it is not working idon't know but why ..............?
And
FileUpload1.PostedFile.SaveAs(Server.MapPath("~/App_Data") + System.IO.Path.DirectorySeparatorChar + FileUpload1.PostedFile.FileName);
ystem.IO.Path.DirectorySeparatorChar What is mean this ....?

Suthish NairPosted Mar 28, 2011, 7:06 AM
Krishna GaradPosted Mar 28, 2011, 4:56 AM
string virtualFolder = "~/Upload/";
string physicalFolder = Server.MapPath(virtualFolder);
FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
it will work for that create Upload folder in root directory. The server.MapPath will map the path on server for specified location.