2015-01-21 91 views
-1

拒絕訪問路徑D:\Hosting\10983309\html\sunithahome\images\GallerySunithaHA\IMG_7162.jpg。 我嘗試在GallerySunitha文件夾中上傳圖像時發現此錯誤。嘗試上載文件時拒絕訪問路徑

我該如何解決這個問題?

if (FileUploadGlry1.HasFile) 
    { 
     string FileName = Path.GetFileName(FileUploadGlry1.PostedFile.FileName); 
     FileUploadGlry1.SaveAs(Server.MapPath("~/images/GallerySunithaHA/" + FileName)); 
     con.Open(); 
     query = "insert into Gallery(ImageName,Caption,ImagePath) values(@Iname,@Cap,@Ipath)"; 
     Sqlcmd = new SqlCommand(query, con); 
     Sqlcmd.Parameters.AddWithValue("@Iname", FileName); 
     Sqlcmd.Parameters.AddWithValue("@Ipath", "~/images/GallerySunithaHA/" + FileName); 
     Sqlcmd.Parameters.AddWithValue("@Cap", TextBoxGalleryCaption1.Text); 
     Sqlcmd.ExecuteNonQuery(); 
     PanelViewImage.Visible = true; 
     con.Close(); 
     TextBoxGalleryCaption1.Text = ""; 
    } 
+0

顯示上傳的一些代碼。 – Mairaj 2015-01-21 04:22:15

+0

實際上它在localhost中工作正常,但在godaddy中託管它之後發生錯誤 – Shelly 2015-01-21 04:24:27

+1

應該直接與godaddy處理的權限問題。 – codebased 2015-01-21 04:42:18

回答

4

Tt的似乎在godaddy的 託管Web應用程序後,你需要給讀寫權foler images保存文件的文件夾,您有問題

你需要使用GoDaddy的configuation面板授予對該文件夾的寫入權限。

更多信息File Upload Permission denied Godaddy Shared hosting

+1

Thaks你設置權限在上天解決了我的問題 – Shelly 2015-01-22 07:19:51