kindeditor.NETӦãҪϴͼƬʱ

protected void Button1_Click(object sender, EventArgs e) { if (IsPostBack) { Boolean fileOK = false; String path = Server.MapPath(~/UploadedImages/); if (FileUpload1.HasFile) { String fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower(); String[] allowedExtensions = { .gif, .png, .jpeg, .jpg }; for (int i = 0; i < allowedExtensions.Length; i++) { if (fileExtension == allowedExtensions[i]) { fileOK = true; } } } if (fileOK) { try { FileUpload1.PostedFile.SaveAs(path + FileUpload1.FileName); Label1.Text = File uploaded!; } catch (Exception ex) { Label1.Text = File could not be uploaded.; } } else { Label1.Text = Cannot accept files of this type.; } } }úÿMSDNķ,ϣ

õ(;31c)ӦûܰŶ∀ѣ

Hash:95fa23d9838ba2260006c215b2539f6c3781450d

声明:此文由 maylee 分享发布,并不意味本站赞同其观点,文章内容仅供参考。此文如侵犯到您的合法权益,请联系我们 kefu@qqx.com