review registry tools

Just another WordPress.com weblog

ASP.net (C #) bulk upload

Upload pictures for this site needs, refer to a lot of mature experience in the ASP.net platform using C # language, to do this automatically bulk upload images. ASPX file, and by the debugged, the use of this site, are sent to for your reference, I hope more master pointers.
The program main features are:

(1) can upload their own need to change the directory to the server, upload the source image, thumbnails, text watermark, image watermark charts to map and set the directory into the different directories;

(2) automatically checks the directory, such as nothing to the selected directory, will automatically create them;

(3) the size of thumbnails generated its own set;

(4) can choose whether to need to generate a text watermark, image watermark, watermark map not generated by default;

(5) can add, delete needed to upload pictures.

In this process the relevant comments were added, so issue a code, no explanation.

Daemon:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Net;
using System.Text.RegularExpressions;

/ / /

/ / / FileUpload1.HasFile If this is true, is that there are files to upload to the control
/ / / FileUpload1.FileName return to upload the file name, does not contain path information
/ / / FileUpload1.FileContent returns a pointer to the uploaded file stream object
/ / / FileUpload1.PostedFile return has a reference to upload files
/ / / FileUpload1.PostedFile.ContentLength return to upload the file that the file size in bytes
/ / / FileUpload1.PostedFile.ContentType return to upload the file MIME content type, that is, file type, such as return “image / jpg”
/ / / FileUpload1.PostedFile.FileName file on the client to return the full path (including file name full name)
/ / / FileUpload1.PostedFile.InputStream returns a pointer to the uploaded file stream object
/ / / FileInfo object that location on the disk or network files. Providing file path, you can create a FileInfo object:
/ / /

public partial class BackManagement_ImagesUpload: System.Web.UI.Page
(
public string treePath = “”;
public int imageW = 100;
public int imageH = 100;
protected void Page_Load (object sender, EventArgs e)
(
this.Button5.Attributes.Add (“Onclick”, “window.close ();”); / / in the local close the current page, without the need to send to the server to close the current page
if (! Page.IsPostBack)
(
Label2.Text = Server.MapPath (“/”);
TextBox3.Text = “ImageUpload”;
treePath = Server.MapPath (“/”) + TextBox3.Text.Trim () + “/”;
TextBox4.Text = imageW.ToString ();
TextBox5.Text = imageH.ToString ();
)
)
protected void btnload_Click (object sender, EventArgs e)
(
/ / If you save the image directory does not exist, create it by the
treePath = Server.MapPath (“/”) + TextBox3.Text.Trim () + “/”;
imageW = Convert.ToInt32 (TextBox4.Text.ToString ());
imageH = Convert.ToInt32 (TextBox5.Text.ToString ());
if (! File.Exists (treePath + “images”)) / / if / ImageUpload / images do not exist, create / ImageUpload / images, used to store the source image
(
System.IO.Directory.CreateDirectory (treePath + “images”);
)
if (! File.Exists (treePath + “thumbnails”)) / / if / ImageUpload / thumbnails do not exist, create / ImageUpload / thumbnails, thumbnail images for storage
(
System.IO.Directory.CreateDirectory (treePath + “thumbnails”);
)
if (! File.Exists (treePath + “textImages”)) / / if / ImageUpload / textImages

Does not exist, create / ImageUpload / textImages, used to store text watermark image
(
System.IO.Directory.CreateDirectory (treePath + “textImages”);
)
if (! File.Exists (treePath + “waterImages”)) / / if / ImageUpload / waterImages does not exist, then create / ImageUpload / waterImages, used to store graphic image watermark
(
System.IO.Directory.CreateDirectory (treePath + “waterImages”);
)

if (FileUpload1.HasFile) / / If this is true, is that there are files to upload the control
(
string fileContentType = FileUpload1.PostedFile.ContentType;
if (fileContentType == “image / bmp” | | fileContentType == “image / gif” | | fileContentType == “image / pjpeg”)
(
string name = FileUpload1.PostedFile.FileName; / / return files on the client's full path (including file name full name)

FileInfo file = new FileInfo (name); / / FileInfo object that location on the disk or network files. Providing file path, you can create a FileInfo object:
string fileName = file.Name; / / file name
string fileName_s = “x_” + file.Name; / / thumbnail file name





Recommended links:



Introduction to BREW SDK papers (2)



OGM converter



The official Chinese version of Firefox Mozilla FireFox 2.0.0.7



JSF and Struts framework for error control AND package handling



CEO? Does not change the financial style, the class!



Convert Swf Files To Zen Mosaic



SWF To MP4



brief Screen Savers



Create UNIX Backdoor (primary chapter)



Managed and Leased operators should pay attention to the problems and suggestions



Of Photoshop CS



Chinese Microsoft Access Help BUG



introduction KIDS Education



MOV to MP4



Recommend Registry TOOLS


October 13, 2010 - Posted by | Uncategorized

No comments yet.

Leave a comment