Im designing a website for someone I know. One of the features he wants is a photo album feature where he can create different albums and upload photos to them.
So uploading the photos is the last thing I do need to do for this photo album feature. Im using the FileUpload control in VS2005. Everytime I try to upload a file, it throws an exception and this is what it says when I catch it and show the message: "Access to the path 'C:\Sites\Single50\mabritoj\webroot\Images\Test Album' is denied. " Now that path is off my Brinkster account. But when I debug thru VS, I get the same message. I looked into it and you need to grant the ASP.NET user account on the system write permissions. for the folder your uploading to So I went ahead and granted the account those permissions. I even asked Brinkster to grant me those permissions and they did. Still get this error. Any ideas on how to get this control to work so I can upload photos? Here is my code for my Upload button that will handle the FileUpload control.
So uploading the photos is the last thing I do need to do for this photo album feature. Im using the FileUpload control in VS2005. Everytime I try to upload a file, it throws an exception and this is what it says when I catch it and show the message: "Access to the path 'C:\Sites\Single50\mabritoj\webroot\Images\Test Album' is denied. " Now that path is off my Brinkster account. But when I debug thru VS, I get the same message. I looked into it and you need to grant the ASP.NET user account on the system write permissions. for the folder your uploading to So I went ahead and granted the account those permissions. I even asked Brinkster to grant me those permissions and they did. Still get this error. Any ideas on how to get this control to work so I can upload photos? Here is my code for my Upload button that will handle the FileUpload control.
Code:
try
{
lblError.Visible = false;
lblError.Text = "";
string uploadDir;
string fullUploadDir;
if (flUpload1.HasFile == true)
{
uploadDir = Server.MapPath("Images/" + ddlCurrentAlbum.SelectedValue);
fullUploadDir = Server.MapPath("Images/" + ddlCurrentAlbum.SelectedValue + "/" + flUpload1.FileName);
if (File.Exists(fullUploadDir) == true)
{
lblError.Visible = true;
lblError.Text = "This photo album already contains an image with this file name";
return;
}
else
{
flUpload1.SaveAs(uploadDir);
}
}