hi,
i convert the file to a byte array and then upload to a server,when i performing this i have an error.
(i.e)
Error 1 : System.Byte[]Error: Could not find a part of the path 'D:\Karthi\fileupload1\Data\System.Byte[]'.
Error 2: Could not find file 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\abs.doc'.
These two error will occur how can i solve this,
Here i attached the codings.
Loading
Suthish NairPosted Jan 30, 2011, 1:24 PM
So other members can easily find the answers.
Suthish NairPosted Jan 28, 2011, 5:08 AM
Lots of articles here about Server.MapPath (even i replied your same post two days ago) and File upload.
How to Upload Files in ASP.NET
File Uploading in ASP.NET 2.0
Krishna GaradPosted Jan 27, 2011, 11:58 PM
krithika muthukrishnanPosted Jan 27, 2011, 11:49 PM
i want the clear explanation about server.mappath();
thank you
Krishna GaradPosted Jan 27, 2011, 11:17 PM
string virtualFolder = "~/Upload/";
string physicalFolder = Server.MapPath(virtualFolder);
FileUpload1.SaveAs(physicalFolder + FileUpload1.FileName);
It will upload file to server. For this you need to create Folder in root directory of your application as "Upload".
krithika muthukrishnanPosted Jan 27, 2011, 8:19 AM
Here i attached coding for upload the file to a server.is this correct or not
codings :
if (FileUpload1.HasFile)
{
try
{
FileUpload1.SaveAs("C:\\Uploads\\" + FileUpload1.FileName);
Label1.Text = "File name: " +FileUpload1.PostedFile.FileName }
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
}
else
{
Label1.Text = "You have not specified a file.";
}
}
Krishna GaradPosted Jan 27, 2011, 6:52 AM