question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

File type is blank in Windows 7 and Windows 10

See original GitHub issue

Using

<input type="file" ngf-select ng-model="uploadSelections.csvFile" />

whenever I look at $scope.uploadSelections.csvFile.type in Mac OS, it returns text/csv as expected.

However, in Windows (7 and 10 tested), running Chrome and IE11, $scope.uploadSelections.csvFile.type returns an empty string ''. The file object looks like this

File {}
  lastModified: 1450235407000
  lastModifiedDate: Tue Dec 15 2015 19:10:07 GMT-0800 (Pacific Standard Time)
  name: "filename.csv"
  size: 20524
  type: ""
  webkitRelativePath: ""
  __proto__: File

Any help would be appreciated.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
danialfaridcommented, Dec 24, 2015

File type property cannot be set programmatically so the best way is to have the check for file extension in the pattern.

0reactions
DrummerHeadcommented, Dec 10, 2020

Hello! I come from the future to tell you not to rely on filetype mime type when using FileList since on Windows this is blank.

Just had this exact same problem, commenting here since this is the only reference to this problem I’ve found online.

-                if (fileList[0].type === 'text/csv') {
+                if (/\.csv$/i.test(fileList[0].name)) {

Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

File Types list is empty - TechNet - Microsoft
Using Windows 7, while checking for help on how to search the contents of files, I have discovered that the File Types list...
Read more >
Folder Shows Empty but Files Are There Windows 10/8/7
The virus hides the files and makes the folder shows empty but has size. Other probable reasons are improper removal of the external...
Read more >
Turn Windows Features on or off blank or empty
Run sfc /scannow or System File Checker to replace corrupted Windows 11/10 system files. 3] Create a new administrator account. Create a new ......
Read more >
8 Ways to Fix Blank Icons on Windows 10 - MakeUseOf
The program provides a graphical interface for accessing all files throughout your system. Restarting File Explorer may resolve the temporary ...
Read more >
How to Add A Blank Space to the Windows 7 Taskbar
Rename the extension at the end file from .txt to .exe – this will change the file into a blank executable. *To change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found