So basically here is how it goes:

I have installed the dev versions of all dependencies. Everything working fine, using also the manual crop too and it works great thanks for that commit.

However I've been a serious problem come up on my end that completely kills the module's functionality.
So everything works on the multiselect widget select form. However when saving or submitting more than one media it will only display one media file on the edit form. Then on save there is "an unexpected error

Here is what was in the log:

exampleurl.com/node/28/edit?render=overlay&render=overlay

REFERRER exampleurl.com/node/28/edit?render=overlay

MESSAGE PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 39,38 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 28 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 661 of /home/e-smith/files/ibays/origins2/html/includes/file.inc).

I've also attached some images

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

P2790’s picture

I should also say that the files were succesfully uploaded.

But also the multiselect of files from the files library has the exactly the same issue.

fangel’s picture

Do you get the same errors when using the normal widget? It sounds rather odd.. The multi-select widget does nothing to change how the file-usage table should be updated..

So please humour me and verify that it works as intended with the normal widget, but fails with the multi-select module.

fangel’s picture

Oh, sorry. Didn't see that it also failed to select all but one file in the widget. So something is certainly wrong with the widget - but not sure how it manages to make file-usage break though.

Could you try and disable as many modules as you can (incl. overlay) and see if that helps. If it does, try enabling modules one by one to figure out what breaks the multi-select widget.

P2790’s picture

Hi Fangel,

Sorry haven't been able to get back on that project. When I do I will do what you say and see what the problem is. I can see that I don't have this issue on a fresh install. I will let you know!

Thanks

fangel’s picture

Status: Active » Postponed (maintainer needs more info)

Okay, super. Marked as postponed.

jchandler’s picture

Status: Postponed (maintainer needs more info) » Active

I got this same issue. Here are my details:

Non-core modules:
Chaos Tools 7.x-1.2
File Entity 7.x-2.0-unstable7
Media 7.x-2.0-unstable7
Media Multiselect (pulled from git yesterday - git clone http://git.drupal.org/sandbox/fangel/1652676.git media_multiselect)
Plupload Integration Module 7.x-1.1
Colorbox 7.x-2.3
Libraries 7.x-2.0
Media Colorbox 7.x-1.0-rc3
Multiple Forms 7.x-1.0
Views 7.x-3.5
Views UI 7.x-3.5

In Chrome developer tools, as I do the multiple image upload, everything seems fine until I click Submit after uploading the files and changing the details. When it goes back to the main edit page, there is only the last of the files I uploaded, and in Chrome developer tools, on the Network tab, I find this:

browser?render=media-popup&types%5B%5D=image&activePlugins=&enabledPlugins=&schemes%5B%5D=public&schemes%5B%5D=private&file_directory=&file_extensions=png+gif+jpg+jpeg&max_filesize=&uri_scheme=public&multiselect=true&plugins=undefined
/TempleTraveler/media

GET

(canceled)

Pending

jquery.js:114
Script

13B
0B

4ms
0.0 days

Then, when I submit the edit page, I get the same error as the other person:

PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 13,14 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 661 of C:\UniServer\www\TempleTraveler\includes\file.inc).

And in developer tools I see this:

edit

/TempleTraveler/node/1

POST

500
Service unavailable (with message)

text/html
Other

2.32KB
6.42KB

795ms
793ms

I'm headed off to work, but if you want me to test anything later on tonight or another evening, I can do that. Or if you have an idea of what may be wrong, but no time to work on it, I can take a look, though I'm only semi-literate in drupal extensions.

jchandler’s picture

OK, I tried removing a ton of modules, and I tried updating Media and File Entity to dev versions. Here's what I have installed right now, outside of core:

Chaos Tools: 7.x-1.2
File Entity: 7.x-2.0-unstable7+37-dev
Media: 7.x-2.0-unstable7+25-dev
Views: 7.x-3.5
Media Multiselect

Still does the same thing. When you select two images from the media selector, it only adds one to the edit page, and then throws an error when you try to save. I've tried to poke through the code, but I just don't know enough about this to find the issue.

I do see what the error is, though. In the SQL where it is trying to insert into the file_usage table, it is returning multiple fids, separated by commas. So, what it should be doing is inserting twice, once where fid=13, and once where fid=14. But instead it is trying to insert one time with fid=13,14. Hopefully that helps.

fangel’s picture

Thanks for the additional info. I will look at this eventually, but I can't promise exactly when I'll get to it.

P2790’s picture

I've done a new install, and everything seems to be working great.
I'm using drupal 7.20.
I installed all modules using drush.

  • Media latest dev 2.x
  • multiform module
  • plupload

I allowed drush to install any dependencies e.g. file entity.
The only module I specified was the media module (dev)

Hope that helps someone

Bernsch’s picture

Priority: Normal » Major

I would upgrade my site from media 1.x to 2.x and install the media multiselect module. Upgrade from 1.x to 2.x is OK.

I test the media multiselect widget with fieldtype "picture", "file" and "Multimedia-Asset".
I have the same problem as in #1 (antonyanimator)

And i becomes this warning:
PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 551,552,553 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 12 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (Zeile 661 von C:\wamp\www\media\includes\file.inc).

I use Drupal 7.21 and the folowing modules:

  • media 7.x-2.0-unstable7+36-dev
  • File entity 7.x-2.0-unstable7+50-dev
  • Media Gallery 7.x-2.x-dev
  • Plupload integration module 7.x-1.1
  • Chaos tools 7.x-1.2
  • Media Multiselect
aaron’s picture

Rob C’s picture

Took some time, but i got some info finally.

I first disabled every single module i could, including like almost all core modules, but that did not change a thing. (and isnt the problem i believe, read on). I then started testing on a fresh install with a basic installation profile.

Some time ago i already noticed the order of the widget in the dropdown when selecting a widget changed at some point.
(on the admin/structure/types/manage/[content type]/fields/field_[field name]/widget-type page)

I was working on one of my older sites and everything works fine on this site before i upgraded to the latest available versions.
After upgrading, everything still works fine on this site, the order of the widget on this page remained the same.

On a fresh install i can't get media multiselect to work, that's all latest versions via git for file_entity 2.x,media 2.x and Drupal 7.22.
And i see the order in that dropdown list is not the same, and the widget crashes, like described in the issue.
Then i also found that installing media multiselect has no effect on this when upgrading to the latest versions.

My old site runs the following:
Drupal 7.19
Media 2.x c7ef48447310caabbebe80647a80d1584294f3e1
File Entity 2.x 7b6830cc2a36ec7942e7e3931487ee605983f001
Media Multiselect (master) f6ffd10375397d374db8f21665b53100f2d166d8

My current site runs:
Drupal 7.22
Media 2.x ecb93923272336edcbe83db2cb6871ead8188912
File Entity 2.x c2d5c3d18da4d9da1e84766eac70df70608d6ce6
Media Multiselect (master) f6ffd10375397d374db8f21665b53100f2d166d8

I can now confirm that after upgrading everything still works.

And yes, i'm using the same media multiselect on my old site (that used to be an older version, but while testing i found that this isn't the problem).

So i'm not sure this is an issue with media multiselect, because my media multiselect version never changed during updating and testing this (extensively), i just started with an older set of file entity and media, and that seems to do the trick (for now).

Aka updates work, but fresh installs do not, and this was introduced not to long ago i believe (and might even have been temporarily fixed at some point), and the order of the dropdown might not have anything to do with it, but that was the only visual change i've noticed).

Hope this helps a bit, and i'm still trying to find the real cause, might continue tonight, but figured, lets already post this.

[edit: moved/added some lines to clarify some bits for future reads + fixed typo]

fangel’s picture

That's some great investigative work! I hope you can narrow it down even further :)

I might have some time Friday to try and look into this, so do let me know if you find any more before then.

fangel’s picture

Okay, so Friday turned to Saturday, but I finally got around to giving this a test.

I just updated all of my modules and core from git, so I had all the latest. Then I created a new database and performed a minimal install on it, enabled the necessary modules, added a content-type with a "image" field on it with unlimited cardinality - and that worked perfectly fine.

I then tried the same with a new content-type with a "media" field on it, also with unlimited cardinality - and that too worked perfectly fine.

The contrib modules I have are:

  • ctools
  • epsacrop (for compatability testing)
  • file_entity
  • libraries
  • media
  • media_multiselect
  • multiform
  • plupload
  • views

The modules I have enabled (drush pml | grep Enabled) are

Group Module Type State Version
Chaos tool suite Chaos tools (ctools) Module Enabled -
Core Block (block) Module Enabled 7.23-dev
Core Database logging (dblog) Module Enabled 7.23-dev
Core Field (field) Module Enabled 7.23-dev
Core Field SQL storage (field_sql_storage) Module Enabled 7.23-dev
Core Field UI (field_ui) Module Enabled 7.23-dev
Core File (file) Module Enabled 7.23-dev
Core Filter (filter) Module Enabled 7.23-dev
Core Image (image) Module Enabled 7.23-dev
Core Node (node) Module Enabled 7.23-dev
Core System (system) Module Enabled 7.23-dev
Core Text (text) Module Enabled 7.23-dev
Core User (user) Module Enabled 7.23-dev
Development Devel (devel) Module Enabled 7.x-1.3
Media Epsa Crop (epsacrop) Module Enabled 7.x-2.x-dev
Media File entity (file_entity) Module Enabled 7.x-2.x-dev
Media Media (media) Module Enabled -
Media Media Field (mediafield) Module Enabled -
Media Media Multiselect (media_multiselect) Module Enabled -
Media Plupload integration module (plupload) Module Enabled -
Other Libraries (libraries) Module Enabled -
Other Multiple forms (multiform) Module Enabled -
Views Views (views) Module Enabled -
Views Views UI (views_ui) Module Enabled -

So sadly, with everything from git, and a clean install I still can't reproduce. Can you tell me what the difference in the ordering of the widget-types are (which changes places). Because that ordering is determined by module weight, which could possible have a difference.

Rob C’s picture

I don't use the media field, that might be the problem.

The media field in 2.x should be deprecated from what i've read, and i don't need it for the sites i've created so far. (if i'm correct)

I'll do a complete new install with the same set you list, without the media field module.
I'll send you the files + db for review if it crashes again.

Order: module weight, yes, so i figured to debug this some more, but didn't found anything.

Rob C’s picture

Update:

When i now attempt a clean install, it works! (on a complete new site, all latest versions)

After some more reading http://drupal.org/node/1212874/commits i see that the last couple days at least 1 form validation error has been fixed. I'll try to confirm it this is the cause, but i can already say that i'm sure with the *current* git versions everything works. (that is: everything from git, no stable releases)

I now have the following enabled:

  • Drupal core 7.x (standard install profile)
  • ctools 1.x
  • views 3.x
  • file_entity 2.x
  • media 2.x
  • media multiselect (master)
  • plupload 1.x (did not test 2.x)

I did not install:

  • Libraries
  • Multiple forms (multiform)
  • Media field (deprecated for sure)

Update on 'media field' module:
I have confirmed this with rootatwc and others, do not install this module on a 2.x install.

fangel’s picture

Okay, I haven't been keeping up to date on the media-field issues. So I guess I'll stop testing against media-field and only against image-fields.

And nice to know that current Git has fixed the problem. If you can find the one commit that fixes it, maybe it's possible to create a work-around for older versions, but otherwise it's a waiting-game until new stable versions are released.

Does anyone know how you would have a field for videos now? You used to be able to have a media-field with only Video as the allowed media-type. Just curious.

Rob C’s picture

I hope i can find it indeed, cause nobody wants that waiting-game, but at least it works again.
Really got my eye on this one, but still need to confirm this. My previous testing site (that didn't work) is only a couple commits away from this commit.

media-type: That's still the same, those features are all migrated. See here for some screenshots.

gmclelland’s picture

I'm getting this error as well.

This happens when you have a file field that uses media multiselect and accepts unlimited values. When I click "select media" I can choose and highlight multiple files, but when I click "Submit" only 1 file shows in the field. If I then save the node, I get the error message:

I was running Media-2.0-unstable7+36-dev from Mar 8, 2013 and File Entity 7.x-2.0-unstable7+44-dev from Mar 8, 2013 when I got this error, but then I upgraded to the latest Media-2.x-dev and File Entity-2.x-dev and I'm still seeing this error. I cleared caches and ran update.php.

Let me know if I can provide any additional information. I would love to get this solved. This module is a huge time saver.

gmclelland’s picture

I just tested this on a fresh install and still received the same errors.

Steps to reproduce:
1. Upload some files at file/add
2. Create a file field on the article content type
3. Set the file field to unlimited values and set it to use only pdf
4. Add a new article, select media
5. Choose media
6. Hit submit
7. You see that only 1 item of your multiple selection is shown
8. Save the node and then you see the error

PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 3,2,1 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 2 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 661 of /Users/glenn/Sites/acquia-drupal/includes/file.inc).

Here is the modules I tested with:
ctools - 1.x-dev
file_entity - 2.x-dev
media - 2.x-dev
media_multiselect - lastest
multiform - 1.0

Hope that helps

gmclelland’s picture

Sorry to be noisy, but I just wanted to point out that it works fine when using this with image fields. The problem only seems to be happening with file fields.

firfin’s picture

Status: Active » Postponed (maintainer needs more info)

Just a thought (or maybe even workaround) for all people still having problems PDO errors on 'file_usage' table.
I used to have a LOT of problems with that, when I was using PRIVATE files. Instead of PUBLIC files
There were and still are major issues with the private filesystem and media module (and even with drupal core it seems.)

BTW this module is working fine for me, at least no errors with 'file usage' at all (since going public ;-) I am using it with imagefields, filefields and file entities.

Maybe you guys could try it out, see if we can narrow it down? Please reopen with more info.

liquidcms’s picture

i have the following:

Media 7.x-2.0-alpha2+3-dev (2013-Aug-22)
Plupload integration 7.x-1.1+9-dev (2013-Mar-08)
media_multiselect - lastest
File entity (fieldable files) 7.x-2.0-alpha2+3-dev (2013-Aug-23) - shouldnt matter

and still get same errors when used on an image field:

- seems to work fine as far as plupload widget goes but then only shows one thumb on edit form. then on node submit i get:

PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 99,100 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 58 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 657 of /home/admin/public_html/umd/includes/file.inc).

liquidcms’s picture

tried upgrading to latest plupload integration 2.x -dev - no help

fangel’s picture

Since I have so far been unable to reproduce this error with any of the mentioned combinations of module, I will ask of a little more help.

If anyone with a Drupal installation that have this problem, is willing to do so, I will gladly accept a tar/zip'ed up folder with an accompanying database-dump. Hopefully that will ensure my ability to reproduce the problem, so it can get looked at.

I understand that people might not be able to do so, out of concerns of privacy, intellectual property etc. So if you can distill you installation down to a bare minimum (that still has the error) before sending, it would be appreciated (It will probably also easy the bug-finding).

gmclelland’s picture

The patch in #2056247: media_multiselect_fids posted as "fid,fid,fid" instead of an array of fids, selecting multiple files doesn't work fixes the problem I was having in #20. If anyone is still having these problems you might want to give it shot.

fangel’s picture

I have committed the patch that hefox contributed in #2056247: media_multiselect_fids posted as "fid,fid,fid" instead of an array of fids, selecting multiple files doesn't work, so try and update and see if it fixes the problem for you guys like gmclelland suggests it might.