Error: file type not supported - unknown file type

Issue #14 new
Dmitry Chekanov created an issue

Hi David,

I've just installed your extension and it refuses to accept any of my .csv files. Whichever file I choose, it always says "Error: file type not supported - unknown file type". I've attached an example to this message. It would be great if you could take a look at the issue.

I'm using extension version 0.0.10 and latest Chrome on Windows 8.1 x64, which you probably can see in the GA error reports.

P. S. Thanks for the article on how to implement user id submission to GA - it was very helpful!

Regards, Dmitry

Comments (10)

  1. Donovan Justice

    Hello David,

    I'm also experiencing this error with Chrome V 46.0.2490.80 and Windows 8.1. No matter what .csv file I pass to the extension, it displays "Error: file type not supported - unknown file type." although the same csv works when using the extension on my mac.

    Thank you.

  2. David Simpson repo owner

    Hi @dbjustice, I can see that there were around failed 45 attempts to upload split ~equally on Windows 8.1/Chrome 46.0.2490.80 & Windows 7/Chrome 43.0.2357.130 from the same US city -- I track all errors using Google Analytics.

    This is indeed most strange. I need to get a test system set up to investigate this further.

  3. David Simpson repo owner

    Further reading suggests that...

    The File object inherits the type property from the Blob object, and the browser uses the blob (byte array) to determine the mime type.

    To accomplish that task each browser implements a file sniffing algorithm to "read" the mime type from the byte array, and if the mime type doesn't match, it will return an empty string like in your scenario above.

    -- Source: StackOverflow answer for "Mime type missing for .rar and .tar"

    I'm thinking that I could actually let files with the CSV extension in through the gate and then attempt to read them. The reason I've not done this in the past is that sometimes people upload a file with a .csv extension which is not a true CSV. This check was meant to catch that one.

  4. Donovan Justice

    I went into regedit and noticed that there wasn't a Content Type listed at all for [HKEY_LOCAL_MACHINE\SOFTWARE\Classes.csv]. I was able to add a new String Value, set Name to 'Content Type', and Data as 'text/csv'.

    Sure enough on the first attempt at importing my csv file, it worked!

    Thank you!

  5. David Simpson repo owner

    OK, I think I'll have to build a fail-through for Windows.

    Likely the following pseudo code:

    if (fileExtension.toLowerCase() === 'csv' && navigator.platform.toLowerCase().contains('win')) {
      // allow file read
    }
    
  6. Ahkeem Lang

    Donovan, I attempted your fix but no luck on my end. I’m still struggling trying to upload the csv files.

  7. Log in to comment