上传就出错了
int EstateID = int.Parse(Session[ "EstateID "].ToString());
if (FileUpload1.HasFile)
{
string SavePath = Server.MapPath( "~/EstateImg/ ");
String[] allowedExtensions = { ".gif ", ".png ", ".jpeg ", ".jpg " };
String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
for (int i = 0; i < allowedExtensions.Length; i++)
{
try
{
if (string.Compare(fileExtension,allowedExtensions[i],true) == 0)
{
string FileName = FileUpload1.FileName;
SavePath += FileName;
int ImgUrlID = Admin.InsertImg(EstateID, FileName);
if (ImgUrlID == 0)
{
Response.Write( " <script> alert( '每个房产最多上传10张图片 ') </script> ");
return;