asp.net picture file Upload and Delete method _ practical skills

Source: Internet
Author: User
Tags file upload

This article illustrates the method of uploading and deleting asp.net picture files. Share to everyone for your reference, specific as follows:

Upload picture public
void Updataimage ()
{
  //Get the selected file
  string fileName = Fudimage.filename;
  Gets the suffix name
  string fileext = Path.getextension (fileName);
  if (Fileext!= ". jpg")
  {return
   ;
  }
  Get server-side-uploaded path
  string serverpath = Server.MapPath ("/web/images");
  Build Folder
  String createdirectory = Serverpath + "\" + "card";
  Fudimage.saveas (createdirectory + "\" + fileName);
}
Delete file public
void Delfile (string path)
{
  System.IO.FileInfo file = new FileInfo (path);
  if (file. Exists)
  {
   file. Delete ();
  }
}

More interested in asp.net related content readers can view the site topics: "asp.net file Operation tips Summary", "asp.net string operation skills Summary", "ASP.net Operation XML Skills summary", "ASP.net Ajax Skills Summary topics" and " Summary of ASP.net caching operation techniques.

I hope this article will help you to ASP.net program design.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.