That is always using others, I want to write a control yourself for the first time. So I wrote a simple small control, mainly for my own learning and other friends who want to try to write controls, please advise. The main role of the modified part is to upload local images to the custom directory. Using system.web.ui; using system.web.ui.webcontrols; using system.componentmodel; using system.web.ui.htmlcontrols; using system.io;
namespace UpLoadImage {///
private void mybutton_Click (object sender, System.EventArgs e) {if {LogoURL = fileUpload.PostedFile.FileName.ToString () (fileUpload.Value.ToString () Equals ( "")!.); LogoURL = LogoURL.Substring (LogoURL .Lastindexof ("."), (Logourl.Length-log.lastIndexof (".")); If (fileUpload.postedfile.contentLength> FileLength) {myscript ("picture exceeds the specified size!");} Else {ix (Logourl.Equals) || logourl.equals (". Bmp") || logourl.equals (". Gif")) {
Logourl = MyDirectory "//" imageurl logourl; mydirectory = page.server.mappath ("") "//" mydirectory;
IF (Directory.exists (MyDirectory)) {} else {Directory.createdIRectory (MyDirectory);} fileupload.postedfile.saveas (") " // " logourl);
IF (VPicture.Equals) {label1.text = "");
}