Fupload doesn't create correct filepath

mathis - June 22, 2009 - 11:01
Project:Image FUpload
Version:6.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I know there are multiple issues with files paths but I'm not sure in wich one I should have posted this so I prefer to create a new one...

I have tried many things but fupload does not place the files that I upload in the correct directory. Sometimes I see my pictures (but they are not in the one they should be) and sometimes the links are simply broken.

I have tried public and private filesystem, with or without token, rc2 and dev... but I don't remember all that I have done so I will just explain my last problem (so selfish!). And of course I have always done the uninstall / update.php / flush cache / remove field - create field /create and delete content.. (this is not in the correct order..)

So for now my configuration is:
filesystem is private, fupload module is rc2, CCk 2.4, filefield 3.0, imagefield 3.0, imagecache 6.x-2.0-beta9, token 1.12.
The filesystem path are /home/myname/drupal_uploads/files or tmp (outside the 'web directory' wich is /home/myname/public_html/) - (directory rights are 700 for files/tmp and 755 for the contained folders)
Image field and image cache work and put the files in the correct directories (with or without token).

The problem:
When I use an fupload field with a simple path (ie photos) I see my pictures when I upload them and when I open the nodes.
But the files are put directly in my 'files' folder (not files/photos/) and the files in the tmp directory remains there.

When I use a path whith token (photos/[user]/[site-date-yyyy]) the path are broken:
http://www.mydomain.com/system/files/imagecache/presetName/%252Fhome/myname/drupal_uploads/tmp/pap03_0.jpg and not what they should be: http://www.mydomain.com/system/files/imagecache/presetName/photos/admin/2009/pap03.jpg
The files remains in my tmp directory and they are duplicated within this directory (original_filename.jpg and original_filename_0.jpg) and nothing is to be found in the 'files' one...

So that's it! (yeah I know that was quite boring to read, sorry!)
Thanks you!

#1

grandcat - June 22, 2009 - 20:20

One thing, I can say directly:

and the files in the tmp directory remains there.

Cron will delete these one later.

Token/Filefield paths might not work correctly in some cases, I still have to do some researches. Keep tracking it.

#2

Tannerjf - June 25, 2009 - 02:00

I am having similar issues on my test environment using XAMPP on Windows. I did a test upload of 20 or so images, and I'm not sure how much it's actually doing. It creates the nodes, and the image paths are there, but it adds the tmp directory to the path. It also isn't creating the images in the folder I specified for them, though the folder exists and drupal has no problems with the paths. I also noticed if I go back in and edit a node, remove the broken image and reupload, it works.

Here is the path it's generating:

http://localhost/algiershookah/sites/default/files/imagecache/test/C:\Web\Server\tmp/IMG_3990_0.JPG

Also doesn't work if I change the display of the field in CCK to use the full size image that is untouched by imagecache:

http://localhost/algiershookah/sites/default/files/C:/Web/Server/tmp/IMG_3990_0.JPG?1245886949

#3

grandcat - June 25, 2009 - 09:44

Another module seems to mess up the paths.

#4

mathis - June 26, 2009 - 10:52

Hi,

Since I am working on my website (the online server where I originaly had my pbs with fupload), and I don't have a lot of time to make some tests, I just set up a new drupal instalation on my local wamp.
The set up was straightforward: let fupload enable the required modules, setup imageMagick, make an image cache preset and set up filesystem (private). I made a first test without token and then enabled it...

So the 'pb' is the same with or without token: it does the upload and creates corrects href to the files (I mean I see the pictures) but it doesn't put the files in correct path if it doesn't already exists. If the folder exists it works correctly.
First test was with a path set up to 'photos':
- files went in 'files' folder.
Create folder files/photos and then correct upload.
Second test with 'photos/[site-date-yyyy]':
-files went to 'files/photos'
Create folder files/photos/2009 and then correct upload...

I don't know what to think about this... Maybe in this case it's just a problem of rights (not sure the way windows handles them since when I look to the folder properties there is always a square in read only even if I deselect it...) and that would mean that fupload works (yeah that's crazy! =) ).
The only way to sort this would be to make the tests on my real server I guess... I'll do that next week!

Have a nice day...

#5

mcload - July 4, 2009 - 18:06

I am having similar problems. I am using Revisioning module. When I delete the revisions, the original files are deleted from sites/default/files/ folder. However, imagecache created version of images remain at sites/default/files//imagecache/storygallery . Also they remain at /tmp folder. I run cron, but they were not deleted. Record of deleted files are still at files table of the database with status 1.

#6

grandcat - July 5, 2009 - 15:56

It will take a while (a constant time) after the tmp images will be deleted.

However, imagecache created version of images remain at sites/default/files//imagecache/storygallery

This has nothing to do with fupload.

#7

mibfire - July 12, 2009 - 20:47

I have the same problem, the files will be uploaded to files dir instead of files/somedir/sometoken(or i created new content type called test and files were be saved in test dir instead of test/[title-raw]) It drives me mad!!!

#8

timtrinidad - July 13, 2009 - 00:58

I can confirm the same behavior. Uploading images with image_fupload will keep files in the /tmp directory (as expected), but the stored paths seem to stay as the tmp files, and imagecache creates its images from there. The node finally stores images that are all like:
system/files/imagecache/photos_thumb/%252Ftmp/14_1_0.jpg
Tokens are properly processed when the filefield or regular image field rather than the image_fupload widget is selected.

#9

timtrinidad - July 13, 2009 - 03:09

Additionally, editing the node and resaving it actually has the expected behavior - the correct directories are created and the files are moved. The initial save, however, still doesn't work.

#10

grandcat - July 13, 2009 - 19:51

The actual token version might not work with FUpload.
If there's any time, I will check this. At least, this should be fixed in the complete rewrite which integrates better in CCK and, of course, in Drupal.

#11

pamreed - July 19, 2009 - 20:51

I am having similar issue. I created a photos sub-directory under files to put all the images in. When I upload images using Fupload it puts them in the 'files' directory not my 'files/photos' directory. I set the path in the content type image field under the 'Path settings" to 'photos'. I get the following error in my reports.

The directory sites/ourfatherschurch.org/files/photos is not writable, because it does not have the correct permissions set.

Directory permissions looks like this drwxrwxr-x.

What should the permission be?

Also, I love this module great work. It is a life saver when uploading many images for photo gallery.

#12

grandcat - July 20, 2009 - 09:25

It seems that you did not set the correct owner/group for the directory "photos". They have to be equal to "files" directory's owner/group and permissions.

#13

ore - July 22, 2009 - 02:06

Adding this :

if(!is_dir(file_directory_path() .'/'. $widget_file_path))
  mkdir(file_directory_path() .'/'. $widget_file_path, 0777, true);

after this:

function _fupload_import_widget_files_directory($field) {
  $widget_file_path = $field['widget']['file_path'];
  if (module_exists('token')) {
    global $user;
    $widget_file_path = token_replace($widget_file_path, 'user', $user);
  }

so the whole function looks like this:

function _fupload_import_widget_files_directory($field) {
  $widget_file_path = $field['widget']['file_path'];
  if (module_exists('token')) {
    global $user;
    $widget_file_path = token_replace($widget_file_path, 'user', $user);
  }
  if(!is_dir(file_directory_path() .'/'. $widget_file_path))
  mkdir(file_directory_path() .'/'. $widget_file_path, 0755, true);
 
  return file_directory_path() .'/'. $widget_file_path;
}

in the file image_upload_imagefield.module around line 574 fixes the tmp and placement problems for me.

havnt tested it with the tokens yet but i imagine it will work for those as well.

cheers

mike

#14

ore - July 22, 2009 - 02:12

yup it works for tokens :D

#15

grandcat - July 22, 2009 - 14:46

Thank you, I will check this one.

#16

rokr - July 28, 2009 - 20:52

Does this also work in conjunction with filefield path?

cheers, Ronald

#17

vegemite4me - July 30, 2009 - 19:30

This fixed it for me. Thank you ore. Great module grandcat.

#18

rokr - August 4, 2009 - 09:01

I have tested it in conjunction with filepath module and it still doesn't work with it.

cheers, Ronald

#19

my-family - August 18, 2009 - 13:09

The same problem (using with ImageField).

#13 code works for me (but not with Filefield path), thanks a lot.

Otherwise, the module is excellent (thanks for it), I hope that this bug will be fixed soon...

#20

Olli1984 - August 24, 2009 - 07:10

#13 is top! Thx!
But i need it for Filefild too, can you do anything?
lg

edit:
Sorry, Fupload and filepath upload works for me! very nice!

#21

Kay200 - September 3, 2009 - 05:44

Hey all,

any update on Fupload + filefield path bug?

any workaround?

#22

grandcat - September 3, 2009 - 18:32

I'm sorry, don't have the time at the moment. Perhaps someone wants to provide a patch.
At least, I will fix it with the complete rewrite (FUpload will become smarter, Preview list will be replaced with Views + another module, ...).

#23

marcus178 - September 24, 2009 - 08:48

I've tried the patch and it still doesn't work.

#24

marcus178 - September 24, 2009 - 15:47

Also I have found that the filepath doesn't work with imagefield but does seem to work in conjunction with the image module

#25

dboulet - September 27, 2009 - 23:31
Status:active» needs review

The code from #13 works well for me, here's a patch.

AttachmentSize
image_fupload-HEAD_498514_create_path.patch 875 bytes

#26

dboulet - September 28, 2009 - 00:11
Status:needs review» active

New patch uses file_check_directory() instead to check for the existence of the directory.

AttachmentSize
image_fupload-HEAD_498514_create_path2.patch 895 bytes

#27

dboulet - September 28, 2009 - 00:12
Status:active» needs review

#28

dboulet - September 28, 2009 - 00:13
Version:6.x-3.0-rc2» 6.x-3.x-dev

#29

marcus178 - September 28, 2009 - 07:47

I have applied both these patches and is doesn't seem to make any difference, the filepath is still being ignored. Have I missed something?

#30

dboulet - September 28, 2009 - 15:38

@marcus178, are you using the Filefield path module? The patch isn't compatible with it.

#31

marcus178 - September 28, 2009 - 16:01

Sorry I thought this related to Filepath

#32

grandcat - September 28, 2009 - 18:45
Status:needs review» fixed

Committed to CVS Head. Thanks for all the help.

#33

dboulet - September 28, 2009 - 19:20

Thanks grandcat. For anyone looking to make this work with the Filefield Paths module, there is a separate issue for that: #409070: Doesn't support file path tokens via Filefield Paths module.

#34

System Message - October 12, 2009 - 19:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.