Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Button1_Click(object sender, EventArgs e)
- {
- string FilePath = FileUpload1.FileName;
- //verify the file whether is exist
- if (FileUpload1.HasFile)
- {
- //verify the file's type
- if (System.IO.Path.GetExtension(FilePath) != ".jpg")
- {
- Response.Write("<script>alert('The fiel type not right !')</script>");
- }
- else
- {
- FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Files/NewFile.jpg"));
- Response.Write("<script>alert('Success !')</script>");
- }
- }
- else
- {
- Response.Write("<script>alert('The fiel is not exist !')</script>");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement