Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7733645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:03:00+00:00 2026-06-01T07:03:00+00:00

as i am trying to upload a File, and i am trying to check

  • 0

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.

   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 
        }
}

now what i thought i will use this code, so that it will solve the problem

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"
        )

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.

  • Apple user may use OpenOffice, or some other softwares to upload. so we need to allow this type of file also

can anybody tell me how to handle this situations

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:03:02+00:00Added an answer on June 1, 2026 at 7:03 am

    i Used File Extension and Even the COntent type validation. along with we restricted user not to upload other than office documents, Even we are tried Telerik Upload controls to achieve the functionalty . once again thank you for all who gave answers .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to code a simple form with file upload which targets the iFrame.
I'm trying to upload a file to an FTP server using code based on
I'm trying to upload a file using JavaFX using the HttpRequest. For this purpose
I was trying to upload a file which is 20MB in size. Now default
I am just trying to upload file to server through the code it working
For some reason when trying to upload a zip file this function always returns
I'm trying to upload a file from Android (2.3.4) using the below code, I
I am trying to upload file using dropbox api but following Code shows some
I am trying to upload a file to a FTP server, which is a
I'm trying to upload image to Amazon S3 with this Ruby code: require 'net/http/post/multipart'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.