I was kinda hoping the new version of Solspace's importer module would make it possible to import images into Assets fields but alas.

I'm currently working on a site with a large (+-4000) product catalogue, each product is an EE entry with 1 image (product shot) in an Assets field + a list of product specifications. (The spec data has already been successfully imported from a csv file using Solspace's importer).

Is there any way to, once the images have been uploaded to the default folder, import the filepath into the entry's Assets field? (EE 2.5.5 - Assets 2.0.5)

2 Answers 2


I just made this work when doing an import from EE1.

I set up templates in the EE1 site to output the channel contents as XML. I was using nGen File Field there, so my image fields look like this:

<photo-photo>{filedir_1}{photo-photo show="filename"}</photo-photo>

nGen File Field uses show="filename" to only output the filename, so I could include the filedir reference as text in the template.

When I imported those into 2.5.5 using DataGrab, I had to set the fieldtype to be EE's File fieldtype first. Those paths would then work. I could see the images in the entry screens.

After I was done with the import, I changed the 2.5.5 fieldtype to Assets. Voila! Everything works.

If I had to re-import, I'd switch the fields back to File, import, and then switch them back to Assets.

  • Just for the record, this is an EE2 build, I'm not importing any data from a previous EE1 site. Thanks for your input though. Apr 8, 2013 at 17:23
  • The EE1 portion is incidental, though. I have a template that generates XML for the data I'm importing. That template presents the images/files with a particular nomenclature. DataGrab is able to parse that into an EE2 File field, and from there I can flip it to an Assets2 field. Apr 8, 2013 at 17:24
  • Did a test run on a separate test channel and it does indeed work well as long as everything's in 1 folder. Any existing Assets subfolder data is lost though when reverting back to EE's file field. Tough call - marking this as a correct answer though. Thanks. Apr 8, 2013 at 21:04
  • I wonder - Could you copy the original Assets data into a new text field and then do a PHP script to loop through and merge those folder names back in? Apr 9, 2013 at 1:11

If your original import included an image filename for each record then can just run an SQL query to prepend the filepath as {filedir_X} where X is the id of your upload directory. Do this for field_id_Y where Y is your Asset custom field's id. Add a where clause to for the relevant channel where Z is the channel_id.

UPDATE exp_channel_data
SET field_id_X =  CONCAT('{filedir_Y}', field_id_X)
WHERE channel_id = Z

If your original import did not include the image filename for each record it would probably be worth doing another import from scratch or to update the exiting entries so you can get the image file name in there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.