File

DataGrab allows you to import files and images into the ExpressionEngine File field.

DataGrab allows you to import files and images into the ExpressionEngine File field. File fields within Matrix and Grid fields are also supported.

Pre-requisites

You will need to have set up a File Upload area.

You will also need to ensure that your PHP is configured to allow plenty of memory and not to time out.

Configuration options

The first pulldown menu selects the data source field that contains the file/image.

The second field allows you to choose a default upload folder.

The third field selects whether DataGrab should try and fetch images/files from specified URLs.

If fetching files from a remote url, you can optionally automatically create the same sub-directory path when importing the file. This will only work if using ExpressionEngine 7.x with the sub-folder option enabled. This can be handy when importing from a Wordpress site, and you want to import files from the wp-content/uploads directory, and keep the dated directory structure intact in ExpressionEngine.

Field formatting options

DataGrab can accept data in 3 formats:

https://mysite.com/images/uploads/filename.png

This will tell DataGrab to use the file filename.png stored in the file upload area with an id of 1. It won’t check to see if the file exists - this lets you do the import and then copy the file into place afterwards. Note, if you do copy the files manually you will probably need to resynchronise the folder afterwards.

filename.png

If you do not specify a file upload folder, DataGrab will use the default folder select in the configuration options.

http://mysite.com/image/filename.png

If you specifiy a URL and set the "Fetch files from urls:" option to "Yes" then DataGrab will attempt to read the file from the specified URL and copy it to the default upload folder you specified in the configuration options. It will also create any additional sizes that you have specified for that folder and resync the folder.

Example file

<root>

    <entry>
        <title>Load a file from a upload folder</title>
        <files>
            <file>https://mysite.com/images/uploads/bnb5.png</file>
        </files>
    </entry>

    <entry>
        <title>Load a file from a URL</title>
        <files>
            <file>http://ee2.dev/images/newmoon.jpg</file>
        <files>
    </entry>

    <entry>
        <title>Load a file from its filename</title>
        <files>
            <file>es.jpg</file>
        </files>
    </entry>

</root>

Last updated