图像没有复制到asp.net的文件夹中 [英] image not copied in asp.net in folder

查看:54
本文介绍了图像没有复制到asp.net的文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI创建



FileUpload newf = new FileUpload();





DayImgName =hewded.jpg;



string fileName_t = Path.Combine(@D:\ images\packages \,DayImgName) ;



newf.SaveAs(fileName_t);





但是图像未复制到该文件夹​​

HI created

FileUpload newf = new FileUpload();


DayImgName="hewded.jpg";

string fileName_t = Path.Combine(@"D:\images\packages\", DayImgName);

newf.SaveAs(fileName_t);


but the image is not copied to that folder

推荐答案

只检查是否对该文件夹授予WRITE权限?



如果您的应用程序是Web应用程序并且您已将其托管在IIS中,则检查Worker进程是否具有写入权限。
Just check if WRITE permission is given to that folder or not?

If your application is web application and you have hosted it in IIS, then check if Worker process has write permission or not.


检查此http://forums.asp.net/t/1527903.aspx [ ^ ]


试用此代码:



Try this code:

<asp:fileupload id="issueCommentFileUpload" runat="server" xmlns:asp="#unknown" />










string issuefileName = string.Empty;
            if (issueCommentFileUpload.HasFile)
                try
                {
                    issuefileName = issueCommentFileUpload.FileName;
                    string destinationPath = Server.MapPath("./Upload/" + issuefileName);
                    issueCommentFileUpload.SaveAs(destinationPath);
                }
                catch (Exception exObj)
                {
                    Response.Write("Some thing wrong");
                    log.Error("GetIncedencePrimaryInfo method Sql Error : " + exObj.Message.ToString());
                }


这篇关于图像没有复制到asp.net的文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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