访问路径'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg'被拒绝。 [英] Access to the path 'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg' is denied.

查看:73
本文介绍了访问路径'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg'被拒绝。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将图片上传到网络服务器,我写了以下代码



I am uploading picture to webserver, and i have written the following code

protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            try
            {
                string filename = Path.GetFileName(FileUpload1.FileName);
                Response.Write(filename);
                FileUpload1.SaveAs(Server.MapPath("~/AddImage/") + filename);
                //StatusLabel.Text = "Upload status: File uploaded!";
                Response.Write("file uploaded");
            }
            catch (Exception ex)
            {
               // StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
                Response.Write("File Error:"+ex.Message);
            }
        }









<我的本地服务器上的
它工作正常,文件正确上传到AddImage文件夹,

但是当我在服务器上运行此代码时,我收到以下错误:

访问路径'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg'被拒绝。



有什么问题,如何解决?

请帮助






on my local server it is working correctly and file is uploading correctly to AddImage folder,
But when i am running this code on server i am getting following error:
Access to the path 'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg' is denied.

What is the problem and how can i fix it???
pls help

推荐答案

由于错误明确指出:该文件夹无法访问。

这通常是权限问题 - 因此更改访问权限以允许写访问权限。具体如何做到这一点将取决于远程系统,但通过FileZilla使用FTP应该相当简单: [ ^ ]可能有帮助。



或者,该文件可能正在使用中 - 我建议您将文件名存储在数据库中,并交叉引用它们为临时文件名,以防止两个用户使用相同的名称上传不同的文件...
As the error clearly states: the folder is not accessible.
This is normally a permissions problem - so change the access permissions to allow write access. Exactly how you do that will depend on the remote system, but it should be fairly simple using FTP via FileZilla: This[^] may help.

Alternatively, the file may be in use - I would suggest that you store file names in a DB, and cross reference them to "temporary" file names to prevent two users uploading the different files with teh same name...


这篇关于访问路径'C:\Inetpub\vhosts\googleindiamarket.com\httpdocs\AddImage\Lighthouse.jpg'被拒绝。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆