Sir,
What is the code for uploading images into server map path?
Thanks regards
jahi
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
jaheena jamalPosted Jun 29, 2011, 1:57 AM
Krishna GaradPosted Jun 29, 2011, 1:44 AM
jaheena jamalPosted Jun 29, 2011, 1:41 AM
Krishna GaradPosted Jun 29, 2011, 1:39 AM
jaheena jamalPosted Jun 29, 2011, 1:36 AM
Krishna GaradPosted Jun 29, 2011, 1:32 AM
jaheena jamalPosted Jun 29, 2011, 1:27 AM
i tried the code above that you give, but same error displayed.
Krishna GaradPosted Jun 29, 2011, 1:16 AM
jaheena jamalPosted Jun 29, 2011, 1:09 AM
below code is in my page. but error has occured.
if ((File1.PostedFile != null) && (File1.PostedFile.ContentLength > 0))
{
string fn = System.IO.Path.GetFileName(File1.PostedFile.FileName);
string SaveLocation = Server.MapPath("image") + "\\" + fn;
try
{
File1.PostedFile.SaveAs(SaveLocation);
Response.Write("The file has been uploaded.");
}
catch (Exception ex)
{
Response.Write("Error: " + ex.Message);
}
}
else
{
Response.Write("Please select a file to upload.");
}
But the error is "Error: Access to the path '--------- ' is denied.
what is the reason for this?
Krishna GaradPosted Jun 29, 2011, 12:51 AM
string virtualFolder = "~/FolderName/";
string physicalFolder = Server.MapPath(virtualFolder);
FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);