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
Post a Comment