Hi,
This issue might be similar to http://drupal.org/node/651312.
When uploading files using the CCK filefield+SWFupload widget (allows multiple file uploads: http://drupal.org/project/swfupload), I get as many "the selected file /var/www/ cannot be copied" errors as there are attached files. The files are sometimes uploaded to the files folder (at the root) or the link generated will be something like "/sites/defaults/files/C:/users.....". The filefield paths are not created and files are not renamed.
If using regular upload (CCK filefield) then filefieldpaths work ok.
If using the "retroactive update" / "active update" options then folders are created and files are moved/renamed correctly (so I don't think it is a permissions issue).
My best guess is that it has to do with handling the array of submitted files that SWFUpload creates and getting data from it.
Any insight into this error?
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#33 | swfupload-filefield_paths-716328-33.patch | 4.34 KB | David Lesieur |
#25 | swfupload-filefield_paths-716328-25.patch | 4.11 KB | David Lesieur |
#24 | swfupload-filefield_paths-716328-24.patch | 1.64 KB | David Lesieur |
#9 | swfupload-filefield_paths.patch | 1.08 KB | David Lesieur |
Comments
Comment #1
Deciphered CreditAttribution: Deciphered commentedHi pimousse98,
This looks like an issue with the way that the FileFields are being created in the SWFUpload, there isn't enough data for FileField Paths to operate on. I recall a few issues with other modules doing the same thing (I believe one was jUpload or something similar) where they needed to make a simple change to their code and everything was peachy.
I'm trying to track down those old issues so I can test this theory, and if so I will provide the information and/or a patch to the SWFUpload module.
Cheers,
Deciphered.
Comment #2
Deciphered CreditAttribution: Deciphered commentedMoved this issue to SWFUpload.
Also, marked as a bug report as whether or not they'd want to try to support FileField Paths, there are issues that need to be fixed.
So far I have tracked down the issue to a few different area.
The file object defined in
swfupload_widget_validate()
doesn't supply enough information about the file object, causing issues. The best what to get the correct information is by usingfield_file_save_file()
but due to a few other issues this isn't a perfect solution.Currently by implementing the following change you will get somewhat working support, but I will go into the other issues in a below:
Change swfupload.module line #141 from:
To:
The two issues I have come across are:
1. The swfupload_widget.js is function
ref.updateStack()
is passing the first (or last?) filename for all the files, so if multiple files are uploaded the above code will rename them all to the same filename_#2. When the files are being renamed, the numbering is starting at an odd offset (2 files, first number starts at 3), guessing this is related to the files being saved already, and
field_file_save_file()
is resaving them?Will try to keep looking into this and come up with a fix.
Cheers,
Deciphered.
Comment #3
Deciphered CreditAttribution: Deciphered commentedAnother option, just to get support for FileField Paths in and pretend the other issues don't exist (not a great approach) is to do the following:
Change swfupload.module line #141 from:
To:
Cheers,
Deciphered.
Comment #4
pimousse98 CreditAttribution: pimousse98 commentedHi Deciphered,
Thank you so much for looking into this! I will test the solutions that you have outlined and let you know what I find out.
Again, many thanks,
Delphine
Comment #5
pimousse98 CreditAttribution: pimousse98 commented#3 works for me! Many thanks!
Comment #6
smalek CreditAttribution: smalek commented#3 solution works for me too. Good job! Thanks
Comment #7
smalek CreditAttribution: smalek commentedsolution #3 still works, but I had a problem with thumbnails in swfupload filed - thumbnails disappeared. I found that imagefield stores this files (default 32px x 32px) in files/imagefiled_thumbs folder, but swfuplod widget searches those files in filefiled_path defined path.
My temporary solution: I was created symbolic link (ubuntu server) named imagefiled_thumbs in files and the target is in imagecache/[preset_100px_folder]
This solution may help.
Comment #8
ManyNancy CreditAttribution: ManyNancy commentedCan somebody create a patch so that this can be committed.
Comment #9
David Lesieur CreditAttribution: David Lesieur commentedThis patch corresponds to the above solution #3. It seems to work, but as mentioned in #7, the imagefield_thumbs do not get saved to the location defined by FileField Paths.
Comment #10
Danny_Joris CreditAttribution: Danny_Joris commentedSubscribing. I have the same issue.
Comment #11
skourak CreditAttribution: skourak commentedI'd also be very interested to see how this issue evolves. Meanwhile, thanks for the effort #3 and #9!
Comment #12
FranCarstens CreditAttribution: FranCarstens commentedThis solution works, however there still doesn't seem to be a solution with tokens. I'm trying to add a path based on [user-raw] and it defaults to tmp. No file(s) uploaded. Without the use of tokens this works fine.
Comment #13
David Lesieur CreditAttribution: David Lesieur commentedMarked #770076: Filefield path settings not respected + thumbnail generation flaky as a duplicate.
Comment #14
EugenMayer CreditAttribution: EugenMayer commentedpelase reopen this issue if the problem does still exist in beta5, i could not reproduce it there
Comment #15
David Lesieur CreditAttribution: David Lesieur commentedI haven't looked at the code, but have tested beta6. It seems to have no improvement in supporting FileField Paths. Even simple file path settings with no tokens have no effect. File name cleanup settings are ignored. Uploaded files all end up in the 'files' directory.
Comment #16
ManyNancy CreditAttribution: ManyNancy commentedSame, not working.
Can the patch be updated?
Comment #17
milos.kroulik CreditAttribution: milos.kroulik commented+1
Comment #18
skilip CreditAttribution: skilip commentedCan someone provide a patch for this issue?
Comment #19
David Lesieur CreditAttribution: David Lesieur commentedMarked #832496: Filefield Path isn't used as duplicate.
Comment #20
timbraeckman CreditAttribution: timbraeckman commentedIs the problem already fixed in a new release?
Comment #21
EugenMayer CreditAttribution: EugenMayer commentedNo, not yet
Comment #22
ManyNancy CreditAttribution: ManyNancy commented#9 was a good temporary solution. I hope someone who understands what was happening can update the patch, it doesn't work at all in the latest.
Comment #23
DMacpherson CreditAttribution: DMacpherson commentedI applied the patch in #3 to the swfupload_widget.inc file and, for the most part, it works. I was able to save a node with images and the images would get saved to a token [nid] directory. e.g. for images in node 12, it would save to the files/12 directory.
HOWEVER...
If I edit and resave the node (even without changing anything), I get this error:
warning: preg_match() expects parameter 2 to be string, array given in /srv/www/htdocs/drupal.6.14/includes/bootstrap.inc on line 777.
I'd get this error x2 per each node. e.g. if I have three nodes, this error appears six times. And it doesn't go away no matter how many times I refresh the node.
BUT...
If I edit the node and double-click the description fields (regardless of whether I actually edit the description or not) and then save, the preg_match errors go away.
Comment #24
David Lesieur CreditAttribution: David Lesieur commentedHere's an updated patch that improves on #9 by creating the thumbnails at their expected location.
However it still needs work because old thumbnails (those created right after uploading, before saving the node) do not get cleaned up.
Comment #25
David Lesieur CreditAttribution: David Lesieur commentedMore improvements, thumbnail cleanup fixed.
Comment #26
EugenMayer CreditAttribution: EugenMayer commentedThank you David!
Comment #27
timbraeckman CreditAttribution: timbraeckman commentedDavid thanks for the great patch. However... here it still doesn't use the filefield path :-(
Comment #28
David Lesieur CreditAttribution: David Lesieur commented@DeLaPena: I'm really surprised to hear that. I'm successfully using the patch daily on a development site. Are you sure that the patch got properly applied? Could you detail the configuration of your field?
Comment #29
timbraeckman CreditAttribution: timbraeckman commentedDavid Lesieur... very weird... the patch didn't work for me so i tried re-installing all modules that have something to do with it and now it works... and even without your patch!! Is this possible?
Comment #30
David Lesieur CreditAttribution: David Lesieur commented@DeLaPena: I don't see how SWFUpload could support FileField Paths without the patch.
Comment #31
ajagadees CreditAttribution: ajagadees commentedGreat, Thanks works for me :)
Comment #32
EugenMayer CreditAttribution: EugenMayer commentedChanging status. Thanks for the contribution and testers!
Comment #33
David Lesieur CreditAttribution: David Lesieur commentedRe-rolled to apply cleanly to beta7. No code change.
Comment #34
3dloco CreditAttribution: 3dloco commented+1
Comment #35
kmajzlik CreditAttribution: kmajzlik commentedplease make beta8 with this change.
Comment #36
skilip CreditAttribution: skilip commentedCommitted. Thanks a bunch all!
Comment #37
ddorian CreditAttribution: ddorian commentedand fixed thanks