digimate:为什么我用控件上传图片时不行了?控件是Imageurl. 

解决方案 »

  1.   

    string FileN=open.PostedFile.FileName.Trim();
    if(FileN!="")//如果要更新图片;
    {
     
    string nam = open.PostedFile.FileName ;//上传图片
    int i= nam.LastIndexOf(".");
    string newext=nam.Substring(i);
    DateTime now = DateTime.Now; 
    string newname=now.DayOfYear.ToString()+open.PostedFile.ContentLength.ToString();   
     Myway="\\DigimatProduct\\PackingInfo\\UploadImage\\"+newname+newext;
    if(newext==".jpg"||newext==".gif"||newext==".bmp")
    {
    open.PostedFile.SaveAs(Server.MapPath("\\DigimatProduct\\PackingInfo\\UploadImage\\"+newname+newext)); 
    }
    else {
    Response.Write("<script>alert('Please Input Right Format Like(jpg gif bmp)!')</script>");
    return;
    }

     }