Hi,

I have an issue uploading images to a server.

This functionality works perfectly within our network. But attempting to upload images to the same server from outside of our network, I get an error - Could not find a part of the path 'E:\inetpub\wwwroot\Folder1\Folder2\'.

Below is a portion of the code.

FileName = Server.MapPath("/" & "Folder1" & "/" & "Folder2" & "/" & ImageName)

If System.IO.File.Exists(FileName) = False Then 
Image.PostedFile.SaveAs(Server.MapPath("/" & "Folder1" & "/" & "Folder2" & "/" & ImageName)
End If

Any ideas?

Suspected a permissions issue but the error message indicates a path problem.

Many thanks for any suggestions.

>Could not find a part of the path 'E:\inetpub\wwwroot\Folder1\Folder2\'...

If "folder1" is your root of the web-app then code should be..

FileName = Server.MapPath("~/Folder2/" & FileUpload1.FileName)

If System.IO.File.Exists(FileName) = False Then 
  FileUpload1.SaveAs(Filename)
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.