Quantcast
Channel: Security Vulnerability
Viewing all articles
Browse latest Browse all 317

Please help in validating excel file upload

$
0
0

Please help in validating excel file upload. I have done coding for uploadation of excel file, and i want to validate whether the file is really a excel or not . I have also checked by renaming an x.exe file like x.exe.xls also by placing server side checking as given bellow but it failed. My requirement is to upload only valid excel file and not any other file like .exe, .dll or exe file tampered as x.exe.xls etc as said before. 

if (fileUpload.PostedFile.ContentType == "application/vnd.ms-excel" ||

  fileUpload.PostedFile.ContentType == "application/excel" ||  

  fileUpload.PostedFile.ContentType == "application/x-msexcel" ||

 fileUpload.PostedFile.ContentType == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" //this is xlsx format ) 

Thanks in advance.

Dipak


Viewing all articles
Browse latest Browse all 317

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>