string filepath = myfile.PostedFile.FileName; int fileSize = myfile.PostedFile.ContentLength;
if (fileSize > 1024 * 100 * 3 * 100)
{ ShowWindows.Show(this.Page, "Can't more than 30M");
return;
}
else
{ string filex = filepath.Substring(filepath.LastIndexOf(".") + 1).ToLower();
if (filex == "jpg" || filex == "gif" || filex == "jpeg")
{
string newsfilename = "S" + DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + filex;
string path = Server.MapPath("~/UploadFiles/Images/");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
myfile.PostedFile.SaveAs(path + newsfilename);
lblatt.Text = path + newsfilename;
} else
{
ShowWindows.Show(this.Page, "Format Wrong!");
}
}
异常:
Access to the path 'D:\Hosting\6786817\html\chinavoiceovertalent.com\UploadFiles\Images\S20110908072334848.txt' is denied. 我的网站地址为http://www.chinavoiceovertalent.com
我原来一直是用的这样的代码没有问题的,现在突然出现这问题,很费解,查阅相关资料,说是没有极限?怎么设置
解决方案 »
- 建立一个网站,如何调用C/S软件的数据?
- JS区没人会没来ASP.NET求帮助
- gridview点编辑后,有DropDownList出现
- 在dropdownlist控件中选好item后,相应的textbox控件自动填上值
- 求一组RadioButton操作的代码?
- I need you help,thinks!
- 水晶报表的错误!应用程序中服务器错误!(在线 急!急!)
- javascript 那么获取不到值
- Asp.NET群,邀高手加入!!!
- 怎么实现在一个站点用户登录后,到另一站点无需登录?
- textbox.Text在少数电脑上显示空白?
- jquery如何得到表格中不为某个class类型的总的行数
说明是没有写权限,检查下你的文件夹权限是否允许.NET读写?