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 8585495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:04:49+00:00 2026-06-11T22:04:49+00:00

I know very well that you are not allowed to upload a whole folder

  • 0

I know very well that you are not allowed to upload a whole folder via drag and drop. The problem is, how can I tell if someone tries to do it? If you drag a folder into the browser, it behaves exactly as if you dragged a file with some extension webkit doesn’t know about, like ‘.sh’. How can you tell the difference?

I have tested this in Chrome and Safari and Firefox on Mac OS X and Windows. Depending on the browser and OS, I get slightly different results. Sometimes it succeeds in uploading a zero-byte file. Sometimes it uploads a picture of a folder. Sometimes it fails to upload anything.

event.dataTransfer.types and event.dataTransfer.items both lie and say the type is “File” or “file” respectively.

Firefox gives this list of types:

{"0":"application/x-moz-file","1":"text/x-moz-url","2":"text/plain","3":"Files"}
  • 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-11T22:04:50+00:00Added an answer on June 11, 2026 at 10:04 pm

    I found a way to do it. The information can be found in dataTransfer.items via getAsEntry, though it’s a little different in different browsers. Also, this doesn’t have a pointer back to the file you wanted, though you can figure it out based on the file name assuming you’re not uploading two files with the same name at the same time. There’s not really much to work with here, so this is the best I could do.

    just_the_files = (dataTransfer) ->
        real_files_set = {}
        for item in dataTransfer.items
            entry = item.getAsEntry?() or item.webkitGetAsEntry?() or item
            if entry.isFile
                real_files_set[entry.name] = true
         (file for file in dataTransfer.files when file.name of real_files_set)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I very well know that it can be done with the help of interfaces
I know very well that null and undefined are distinct in JavaScript. However, I
I do ActionScript 3.0 programming and I know that very well. I have a
I don't know MySQL very well so I need a bit of help with
I know this works very well: def locations(city, *other_cities): print(city, other_cities) Now I need
I'm new to python so I really don't know the language very well. the
I know very little about Flash, and so is not programming in it. I
So I know that there is a very similar question to this all over
I don't know very well about RAM and HDD architecture, or how electronics deals
I know that Floyd–Steinberg dithering algorithm can't be implemented with pixel shader, because that

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.