I want to upload multiple files with fileupload. That works :) But it should upload multiple files with a Limit of 5 files. Here is my behind code:
protected void btnUpload_Click(object sender, EventArgs e) { StartUpLoad(); } private void StartUpLoad() { string imgName = FileUpload1.FileName; string imgPath = "~/Uploads/" + imgName; int imgSize = FileUpload1.PostedFile.ContentLength; string ext = System.IO.Path.GetExtension(this.FileUpload1.PostedFile.FileName); if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "") { if (ext.ToUpper().Trim() != ".JPG" && ext.ToUpper() != ".PNG" && ext.ToUpper() != ".GIF" && ext.ToUpper() != ".JPEG") { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('Only .jpg, .png oder .gif!')", true); } else { FileUpload1.SaveAs(Server.MapPath("~/Uploads/") + FileUpload1.FileName); Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "Alert", "alert('Saved!')", true); } } }
FileUpload.PostedFiles
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)