Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem in uploading files

Status
Not open for further replies.

dvknn

IS-IT--Management
Mar 11, 2003
94
0
0
US
I am trying to upload files to the server in asp.net. I made sure that the folder to which I am uploading has aspnet read/write permissions but

when I upload I get this error
Could not find a part of the path c:\web\folder1\folder2\sample.JPG

Can any one guide me on this error
Your help is greatly appreciated.




 
can I see your code m8? cause it should work.
I think the application is searching for that folder on the clients computer instead of searching for it on the server.
 
Here is the code

just for your information the application and folder to which I want to upload the files are on same machine

private void btnUpload_Click(object sender, System.EventArgs e)
{
HttpPostedFile file = fileUploader.PostedFile;
string finalPath = null;
string serverPath = null;
if (file.FileName != "")
{
Trace.Write(file.ContentLength.ToString());
string fileName = GetFileName(file);
Trace.Write("fileName :" + fileName);
serverPath = Server.MapPath("\\packaging");
Trace.Write("serverPath :" + serverPath);
finalPath = Path.Combine(serverPath,fileName);
file.SaveAs(finalPath);
Trace.Write("Haha... file uploaded");
Label2.Text = finalPath;
}

}

Please take a look at it help me. I am really stuck on this
 
why don't you use the asp.net upload control? it's easy to use this control : <INPUT id="File1" type= "file" name = "File1" runat="server">

and use this code to upload the file in vb:
file1.postedfile.saveas(Path+Filename)
 
Where can I get the upload control and how can i use it?

Thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top