我收到错误访问路径被拒绝,我的上传代码在本地运行良好 [英] i am getting error access to the path is denied , my upload code is running good on local
问题描述
protected void UploadButton_Click(object sender,EventArgs e)
{
if(FileUploadControl。 HasFile)
{
尝试
{
string filename = Path.GetFileName(FileUploadControl.FileName); < br $>
FileUploadControl.SaveAs(Server.MapPath(〜/ images /)+ filename.ToString());
StatusLabel.Text =上传状态:文件已上传!;
}
catch(例外情况)
{
StatusLabel.Text =上传状态:文件无法上传。发生以下错误:+ ex.Message;
}
}
}
protected void UploadButton_Click(object sender, EventArgs e)
{
if (FileUploadControl.HasFile)
{
try
{
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("~/images/") + filename.ToString());
StatusLabel.Text = "Upload status: File uploaded!";
}
catch (Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
}
推荐答案
你可能已经写了pe在文件夹的文件系统中禁用了缓存:通过FTP检查它,你应该可以远程更改它。
You've probably got write permissions disabled in the file system for the folder: check it via FTP and you should be able to change it remotely.
HI,
您要在该文件夹中导入文件的文件夹,您也可以授予本地用户以及管理员的完全权限。
如果文件夹在子文件夹中,则提供对主文件夹的权限。 br $> b $ b
我希望它对你有所帮助。
谢谢
which folder you are going to import file in that folder you can give full permission of local user as well as administrators also.
if the folder is in subfolder then provide permission to main folder.
I hope it will be helpful for you.
Thanks
这篇关于我收到错误访问路径被拒绝,我的上传代码在本地运行良好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!