I'm trying to upload a file to my website using a method I found on the net. When i upload files in debug mode, it works fine, but when I try to upload on my website, I get this error.
Access to the path 'D:\Hosting\11029316\html\gizmoblog\Content\Images\dpi.jpg' is denied.
This is the method I'm using to upload files.
public ActionResult UpdateLogo(HttpPostedFileBase SiteLogo)
{
if (SiteLogo.ContentLength > 0)
{
var fileName = Path.GetFileName(SiteLogo.FileName);
var path = Path.Combine(Server.MapPath("~/Content/Images"), fileName);
SiteLogo.SaveAs(path);
}
}
Is there a way I can upload the file using a FTP stream? Or even upload them using a URI to my website like http://www.weburl.com/uploads/filename? Really need help guys..