Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
How Discord checks if a Javascript File is a folder on client side?

I notice that Discord can detect if you drop a folder without sending any validation request to a server, all in the client. How can I do that?

When a file is submitted from an <input type="file"> then there is no problem, because it can't select folders, but on a drag-and-drop system you can drop anything and I'm looking for a way to detect folders because it's weird how if you drop a folder, let's say folderExample you get a File object with the property type="", BUT when you drop the same folder with a name like folderExample.jpg now the type is "image/jpeg"!!!

There is how I'm handling the file dropping, hope some can help

const handleDrop = (e) => {
    e.preventDefault();
    e.stopPropagation();
  
    const {files} = e.dataTransfer;
    console.log('Dropped files:', files)
  };
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!