Closed (fixed)
Project:
Migrate Extras
Version:
master
Component:
Migrate Extras Features
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Jan 2010 at 23:30 UTC
Updated:
31 May 2010 at 20:56 UTC
Hi
I'm trying to upload nodes where the images are already saved on the server. The nodes have a filefield pointing to the location of the images in the images folder. But, I get the following error.
warning: filesize() [function.filesize]: stat failed for IMAGEFILEPATH_AND_NAME.jpg in /EXAMPLE.com/web/content/modules/acquia/filefield/field_file.inc on line 154.
Any ideas how I can debug this?
best wishes
scotjam
Comments
Comment #1
scotjam commentedUpdate. Looking at the miration messages, I get errors for each image like this...
File save failed for /acquia-drupal/sites/default/files/uploadimages/001/100.jpg
Hope this helps.
Comment #2
mikeryanAt /admin/settings/file-system, is your file system path sites/default/files? Does that directory exist, and is it writable?
Comment #3
scotjam commentedJust checked that and I can confirm that sites/default/files exists and is writeable. To test this I created a new node together with an uploaded image. The node was created and the image was uploaded to sites/default/files.
Could some code be added to output where the filesize function failing? then I could make sure that filesize is checking the right place or not. OR, can I comment out bits of code to by pass these checks and see whether I can force the migration?
Comment #4
scotjam commentedUpdate on errors...
# warning: filesize() [function.filesize]: stat failed for example.JPG in /example.com/web/content/modules/acquia/filefield/field_file.inc on line 154.
# warning: filesize() [function.filesize]: stat failed for example.jpg in /example.com/web/content/modules/acquia/filefield/field_file.inc on line 154.
# The selected file example.jpg could not be saved. The file is not a known image format.
Comment #5
mikeryanFilefield support has been moved to the migrate_extras module.
Comment #6
ryan88 commentedI am having the same problem. I uploaded the images to the /sites/default/files/ folder, and I have made sure all that all folders and files have all read/write capability (777).
# warning: filesize() [function.filesize]: stat failed for /sites/default/files/events/786.jpg in /home/devsite/public_html/sites/all/modules/filefield/field_file.inc on line 154.
I am not sure if it is a problem with the my settings, filefield, or migrate. Any ideas?
Comment #7
ryan88 commentedFinally made this work for me. I was originally putting "/sites/default/files/events/786.jpg" into the field, and that is when I got the error. After fooling with it, I tried putting "/home/devsite/public_html/sites/default/files/events/786.jpg" and I got it to work without any error.
Comment #8
frankcarey commentedComment #10
grasmash commentedI'm getting this same error:"warning: filesize() [function.filesize]: stat failed for ..."
I've placed my files in "sites/default/files/projects/images."
The table row to be migrated (pImage) contains only the filename. I edited the corresponding table-wizard-generated view for this table, set it so that the field pImage is rewritten to "/server/file/path[pImage]", and tried again, but it doesn't seem like Migrate is grabbing the updated view. It still gives an error containing only the file name (not the path + filename).
I've tried setting the file system default path to "sites/default/files/projects/images" but this makes no difference.
Am I missing something here? Do I need to modify the table directly via phpmyadmin and concatenate the filepath with the filename (not that I know the command to do that)?
As I understand it, the table-wizard view acts as an intermediary between the actual table that the Migrate module, so I assumed that manipulating the views output would pass along the correct field values to Migrate. Is this right? Is there a way to check and see exactly what data Migrate is seeing? Is it enough to just pass the path+filename to migrate and place the files at that location?
Any help would be appreciated! Thanks!
Comment #11
frankcarey commentedFYI: Views is really just used to generate the SQL query, and the fields from the table are used as they are (raw). Though you can reformat things in views, if it doesn't change the query then it will be ignored. You can see the sql generated when you preview the view.
To get the filenames to match up to a real directory, you can create a symlink in your drupal installation to the folder the images you want to import. Then you can use a hook_migrate_prepare_filefield()? in a custom module to manipulate the import path.
Comment #12
grasmash commentedThanks for the response.
When previewing the view, it shows a giant table. In the pImage row, it does show the path+filename correctly. The actual query that is displayed isn't very informative:
"SELECT bdc_projects.pID AS pID,
bdc_projects.pCategory AS bdc_projects_pCategory..."
It doesn't show the value of any field.
I'm not familiar with either symlinks or building custom modules, although I do have a decent handle of php.
I'll look into this. Please let me know if you can think of any way to accomplish this without a custom module. If not, is there any chance you could give me a brief explanation of how a symlink would work in conjunction with the "hook" function?
Thank you!
Comment #13
grasmash commentedWell I wasn't sure how to go about fixing the issues you recommended, but I did find a way. I logged into the relevant mySQL database via php my admin and manually edited the column containing the files names. I ran these SQL commands to concatenate the file path (where the images are located on the server) with the existing filename value.
UPDATE my_table SET my_column = Concat('/path/to/files/', my_column) WHERE my_column IS NOT NULL
That seemed to do the trick. Thanks for your help.