图片无法上传. [英] Images cannot be uploaded.

查看:70
本文介绍了图片无法上传.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我已经托管了一个网站"http://ccub.in.在此站点中,有一个名为accountopen的aspx页面.我可以在Visual Studio中运行该应用程序时在该页面中上传必要的图像.尝试在网上做同样的事情.

Hi All,
I have hosted a website "http://ccub.in .In this site, there is an aspx page named accountopen.I can upload necessary images in that page while running the application in visual studio.But I am getting the following error while trying to do the same online.

Error:Access to the path 'C:\vhosts\ccub.in\httpdocs\com_addressproof\proof.jpg' is denied.


用于上传图像的服务器端编码为:


Server side coding for uploading image is:

if (FileUpload1.HasFile)
            {

                string filename = Path.Combine(Server.MapPath("~/com_addressproof"), FileUpload1.FileName);
                serverfile1 = Path.GetFileName(FileUpload1.PostedFile.FileName);
                path1 ="com_addressproof\\" + serverfile1;
                if (File.Exists(filename))
                {
                    lbl_msg.Visible = true;
                    lbl_msg.Text = "The Communication Address Proof file name  already exists. So Please change the file name and then Proceed ! ";
                    return;
                }
                FileUpload1.PostedFile.SaveAs(filename);

            }


有人可以建议我进行任何修改吗?


Can anyone please suggest me any modifications?

推荐答案

您需要将IUSR_MACHINENAME用户的读/写权限分配给该文件夹

检查这些链接

http://msdn.microsoft.com/en-us/library/aa545633 (v = cs.70).aspx [ http://www.hostasp.net/forum/files-management/122-how-to-give-a-read-/-write-permission-on-file-/-folder.html [
You need to assign the read/write permissions to the IUSR_MACHINENAME user to this folder

Check these links

http://msdn.microsoft.com/en-us/library/aa545633(v=cs.70).aspx[^]

http://www.hostasp.net/forum/files-management/122-how-to-give-a-read-/-write-permission-on-file-/-folder.html[^]


您需要允许用户IUSR_< server_name>的写访问权限; (或相关用户,取决于您是否使用匿名访问或模拟).
You will need to allow write access for the user IUSR_<server_name> (Or related user depending on if you are using anonymous access or impersonation) to the folder.


这篇关于图片无法上传.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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