简体   繁体   中英

Uploading Files To Server Path

I have:

Works locally:

string filePath = Server.MapPath("/Content/Images/Profiles/") fileToUpload.SaveAs(filePath);

When I deploy, on my actual web server I have a few issues, and I'm certain it's to do with the path.

The path returned is: C:\\Inetpub\\vhosts\\myhost.com\\httpdocs\\Content\\Images\\Profiles\\TestUser.png

Naturally, I cannot navigate to this path.

What am I missing? Should I explicitly specify the server path eg '\\myhost.com\\httpdocs\\Content\\Images\\Profiles\\'? or stick with 'MapPath'?

Do you have access to the server? I had the same problem and find out that when you publish a project , the empty folders don't created to the server. I recommend you either create manually the folder to the server if you have access or just put some file in the "Profiles" folder so to be created.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM