asp.net - In asyncfileupload check content type -


in asyncfileupload want check zip , rar try following code

    protected void fileuploadcomplete(object sender, asyncfileuploadeventargs e)     {         string type = fileupload1.contenttype;      } 

when upload zip or rar file in type variable when debug type "application/octet-stream". how can check zip or rar file. can check using javascript after how can upload on server if use javascript checking.

try this:

httppostedfile fileupload1 = context.request.files[0]; system.io.fileinfo fileupload1info = new system.io.fileinfo(up.filename); string ext = fileupload1info.extension; if(ext!='.zip' || ext!='.rar'){       //your logic  } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -