c# - File upload after dropdown selected -


I have a dropdown list & amp; File uploader Here I want to, when the dropdown list was selected & amp; After that the file uploader needs to be loaded. My coding always shows that there is no file. Here I need to have the selectedValue file passes to the database with the uploader.

My code

  protected zero drpuser_SelectedIndexChanged (Object Sender, EventArgs e) {GUID SelectedUserId = Guid.Parse (drpuser .SelectedValue); FileUploader (); }   

FileUploader

  Public Zero FileUploader () {// user = Membership.GetUser (); If (roles.USUUSAEINOL ("Administrator")) {GUIDED SELECTED USIRIID = GID. Purse (doped value selected); // & lt; - Value the correct foreach (String S. files in request) {HttpPostedFile file = Request. Files]; Int fileSizeInBytes = file.ContentLength; String fileName = file.FileName; String file extension = ""; If (! String.IsNullOrEmpty (fileName)) fileExtension = path GetExtension (fileName); Guid UserGUID = (Guid) membership. GETUser () ProviderUserKey; String UserFolderPath = "~ / Uploaded Files /" + UserGUID; System.IO.Directory.CreateDirectory (Server.MapPath (UserFolderPath)); String savedFileName = Path.Combine (Server.MapPath (UserFolderPath), fileName); String fullpath = userfollow path + "/" + fileName; file.SaveAs (savedFileName); DataAccess da = New DataAccess (); da.AddAdminFiles (UserGUID, fullpath, datetime. Now, true, chosen user id); }} Else {}    

I'm thinking that the file will be posted only on the actual Submit .. I'm not sure if any AutoPostBack file will automatically submit. Probably too much HTTP overhead.

If you can, add a "submit" button instead and supply the item and a file from the drop down list, then when the user submits, see the HTTP file, and This request should be in the object.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -