3

I am using Plupload to upload .csv files to my site. It works fine except the problem that it doesn't filter .csv files correctly in the file selection model.

This is the code I'm using to filter only .csv files:

filters : [
    {title : "Files of type", extensions : "csv"},
],
Piotr Kula
  • 9,597
  • 8
  • 59
  • 85
linkyndy
  • 17,038
  • 20
  • 114
  • 194
  • Have you tried to set another filter to see if it filter `jpg` for example? Maybe some syntax issue. – Piotr Kula Aug 06 '12 at 16:13
  • It works with `jpg`, 'docx' and 'xlsx', and that makes everything weirder. Why don't `csv`s get filtered out correctly? – linkyndy Aug 07 '12 at 08:46
  • Yea that is strange. I think it is worth opening a bug at plupload. The only thing you can do is manually iterate through the queue and remove anything else. Do you want some code? – Piotr Kula Aug 07 '12 at 08:48
  • It doesn't happen in the queue, it doesn't filter the desired extensions in Windows' modal where you are prompted to select the file you wish to upload. In `Custom files` `csv` files don't appear; in order to select one, you have to select `All files`. – linkyndy Aug 07 '12 at 09:03
  • 1
    Yea- I know-- we jsut established that it seems like a bug. So only thing to do is find another modal window(impossible) or let them choose what they want and filter it on queue with some hard codding.. – Piotr Kula Aug 07 '12 at 09:12
  • 1
    This will be the backup solution, but thought there is another solution to this bug...Thanks for the help! – linkyndy Aug 07 '12 at 09:24

2 Answers2

5

Look at input[file=type] generated by Plupload, especially in its accept attribute. Plupload adds text/csv value for csv files, which is wrong. The correct value is just .csv

<input type="file" accept=".csv">

Related: HTML Input="file" Accept Attribute File Type (CSV)

Until this issue was not fixed by Plupload team, you can fix it yourself by removing

,text/csv,csv

from plupload.full.min.js (or whatever you use).

Community
  • 1
  • 1
evpozdniakov
  • 533
  • 6
  • 6
4

Sadly enough I couldn't find the source of this, but I once ran into this issue myself.

The problem was that it will only show the (for example) .csv filter if that extension is registered on the computer you're trying to upload a file.

So if you were testing this on a computer that does not have the .csv extension registered by a program this is most likely the issue.

As I remember I had this issue on Chrome. Not sure what browser you were testing with?

So if this issue is indeed the cause of your problem then this is nothing that Plupload can do for you.

Tim
  • 126
  • 5