Importing files

Closed

Import WP Pro Updated 4 months ago 1 Reply

Benjamin asked 4 months ago on January 6, 2024 at 8:22 am

Hi,

I haven’t figured out how to import a file present in the media library to an ACF Document field.

Here is what I have done:

– I have a bunch of files available at /2023/12/{filename} in the media library.
– I am importing posts from a CSV with a file column containing {filename}. 
– In my importer, I select ACF – Document and I select the column value.
– Under Settings, I select Download: Media Library

This doesn’t work, so I have tried these alternatives:

– Adding the relative path to the field’s value, eg /2023/12/{16} (<– this is the file column’s number)
– Adding the full path
– Adding the full path and selecting Download: Remote URL
– Adding the full path and select Download: Local filesystem

None of these work: the file field remains empty after import.

What am I doing wrong?

Thanks!

J

James replied Support Agent

4 months ago on January 6, 2024 at 3:19 pm

Hi Benjamin,

Importing files from the media library, expects that you have the file already uploaded to your media library this is referenced by filename in your csv/xml file.

For example for me to test your issue, i created a blank wordpress install, and activated importwp, importwp-pro and advanced-custom-fields plugins.

I then uploaded a file to the media library with the filename sample.pdf (shown in the screenshot 01-file-in-media-library.png).

Followed by creating a test acf field group with the a file field named "Document" on the post post_type.

Next i created an importer, with the attached test.csv file, which has a single record in it, referencing the pdf file in the 3rd column "sample.pdf" ({2} when selected in the importer because it counts from 0).

Adding a custom field on the importer via the custom fields section, using the custom field prefixed with "Advanced Custom Fields - ", and selecting the csv column as the value {2}, changing the Download dropdown to "Media library".

Running this created the new post, with the media file attached (as shown in 05-imported-record)

Is this the same workflow as you have tried, if so:

1. can you take a screenshot of the media library showing the a file you are trying to connect,
2. attach a copy of your import file,
3. export and attach your importer settings to this ticket by going to Tools > Import WP > Settings / Tools > Import / Export and select and export your importer as a JSON file
4. export and attach your acf field groups via ACF > Tools.
5. confirm you are using the latest versions of the importer importwp v2.11.4 , importwp-pro v2.9.8

James