Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Accept Files With Specified content type accross the Operating system
    text
    copied!<p>as i am trying to upload a File, and i am trying to check for their extension, as i know it is not a good practice, so this is the code which i am doing this. it works fine, but as i am facing issue in Apple Mac Users, they are not unable to upload pdf files. </p> <pre><code> if (upload1.HasFile) { Finfo = new FileInfo(upload1.PostedFile.FileName); if (Finfo.Extension.ToLower() == ".docx" || Finfo.Extension.ToLower() == ".doc" || Finfo.Extension.ToLower() == ".xls" || Finfo.Extension.ToLower() == ".xlsx" || Finfo.Extension.ToLower() == ".pdf" || Finfo.Extension.ToLower() == ".jpg" || Finfo.Extension.ToLower() == ".png" || Finfo.Extension.ToLower() == ".gif" || Finfo.Extension.ToLower() == ".txt" || Finfo.Extension.ToLower() == ".mp4" || Finfo.Extension.ToLower() == "ppt" || Finfo.Extension.ToLower() == ".bmp" || Finfo.Extension.ToLower() == ".swf" || Finfo.Extension.ToLower() == ".rm" || Finfo.Extension.ToLower() == ".pptx") { // Accept File } } </code></pre> <p>now what i thought i will use this code, so that it will solve the problem </p> <pre><code>if ( upload1.PostedFile.ContentType == "text/rtf" || upload1.PostedFile.ContentType == "application/doc" || upload1.PostedFile.ContentType == "appl/text" || upload1.PostedFile.ContentType == "application/vnd.msword" || upload1.PostedFile.ContentType == "application/vnd.ms-word" || upload1.PostedFile.ContentType == "application/winword" || upload1.PostedFile.ContentType == "application/word" || upload1.PostedFile.ContentType == "application/msword" || upload1.PostedFile.ContentType == "application/x-msw6" || upload1.PostedFile.ContentType == "application/x-msword" || upload1.PostedFile.ContentType == "application/pdf" || FileUpload1.PostedFile.ContentType == "application/x-pdf" || upload1.PostedFile.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || upload1.PostedFile.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.template" ) </code></pre> <p>is it good way to Accept Files from users. I need to allow All Files Except EXE,DMG, DLL,CS, SQL, BAT, . how do i ensure that it will work on all operating systems.</p> <ul> <li>Apple user may use OpenOffice, or some other softwares to upload. so we need to allow this type of file also </li> </ul> <p>can anybody tell me how to handle this situations </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload