Import media files with VIP-CLI
Media files that are contained within a file archive (.zip, .tar.gz, or .tgz) can be imported to the VIP File System from a publicly accessible remote URL or from a user’s local machine with the VIP-CLI command: vip import media [options] [command]
Prerequisites
- VIP-CLI is installed and has been updated to the most current version.
- A user must have at minimum either an Org member role or an App write role for that application.
- Review all requirements and limitations that apply to importing media files with VIP-CLI.
VIP-CLI command examples
For demonstration purposes, the <app-name> value example-app and the <env> value production are used in the VIP-CLI command examples below. Read more about how to target environments in VIP-CLI commands.
Example command for importing an file archive from the user’s local machine located at file path /path/to/uploads.tgz:
vip @example-app.production import media /path/to/uploads.tgzExample command for importing an file archive from the publicly accessible URL https://www.example.com/uploads.tar.gz:
vip @example-app.production import media "https://www.example.com/uploads.tar.gz"Note
File-sharing services such as Dropbox, Box, or WeTransfer can be used to host an file archive at a publicly accessible remote URL (e.g. https://www.example.com/uploads.tar.gz).
If using a downloadable Dropbox URL, it must include a ?dl=1 query parameter.
Google Drive URLs are not supported.
During the import process, the CLI will display the real-time progress of the import. The real-time progress of an import can be hidden by pressing the Ctrl + C key combination.
When all files in the archive have been processed, a status report for the import will be created within the current working directory. The exact path to the status report will be output in the terminal.
Caution
SVG files allow embedded JavaScript, which can pose a security risk. If an SVG file exists in an uploads/ directory for import, the contents of the SVG file should be scanned prior to import.
Examine the contents of an SVG file with:
- A local PHPCS scan using the
WordPress-VIP-Gostandard - A file editor (e.g. Visual Studio Code)
- Or a tool such as the SVG Sanitizer Test or VIP’s SVG Sanitizer
Check the status of a media import
VIP-CLI command: vip import media status [options]
Check the status of a currently running media file import or retrieve an error log of the most recent media import.
- If an import is currently running, the output will be for the currently running import, and the
statuscommand will continually check and report back on the status of the import process until it is in a finished state (COMPLETED,ABORTED, orFAILED). - If an import is not currently running, the output will be for the import that ran most recently.
Example output of the vip import media status command:
vip @example-app.production import media status
=============================================================
Checking the Media import status for your environment...
Imported Files: 95/100 - 95% ✓
=============================================================
Status: COMPLETED ✓ : The imported files should be visible on your App
App: mytestsite (PRODUCTION)
=============================================================
⚠️ 5 file error(s) have been extracted
All errors have been exported to /Users/myuser/media-import-mytestsite-1642371503508.txtThe Imported Files: field in the output provides the number and percentage of files that were successfully imported.
An included warning (⚠️) message in the output will report if any files failed to import. The associated errors will be exported to an error log for review.
The Status: field will display the overall import status with the following possible states:
| Import status | Description |
INITIALIZING | Contents of the archive file in the URL are downloading. |
RUNNING | Files are being imported to the File System. |
COMPLETING | The import is finishing up. |
COMPLETED | The import is completed. |
ABORTING | The import is responding to a vip import media abort request. |
ABORTED | The import is aborted. |
FAILED** | The import failed. |
**The import can be in a FAILED status for a variety of reasons. Review status output, error logs, limitations, and the import checklist before attempting another media import.
Abort an import
VIP-CLI command: vip import media abort [options]
Abort an import process in progress. All files that were imported prior to executing the abort command cannot be deleted with a VIP-CLI command. Imported files that have attachment data in a site’s database can be deleted through the WordPress Media Library.
vip @example-app.production import media abortFormat error logs in JSON
--exportFileErrorsToJson
Values not accepted.
When running the vip import media VIP-CLI command, if one or more files fail to import, an error log will be generated and can be retrieved at the end of an import. Error logs include a list of failed files and the reasons for their failure.
By default, import error logs are created in .txt format. Add the --exportFileErrorsToJson option (or -E) to write the error logs to a .json file instead.
vip @example-app.production import media "https://www.example.com/uploads.tar.gz" -exportFileErrorsToJsonImport intermediate images
--importIntermediateImages
Values not accepted.
Traditional installations of WordPress create intermediate images; an array of smaller versions of each uploaded image. The generated intermediate files are unnecessary on VIP, as the VIP File System is able to dynamically generate and cache any requested dimension of the originally uploaded image. This reduces the amount of storage a site requires and provides image size flexibility at no loss of speed.
If needed, intermediate images can be imported by including the --importIntermediateImages option (or -i) when running the vip import media command. When including intermediate images for an import, the process will take a longer time to complete.
vip @example-app.production import media /path/to/uploads.tar -importIntermediateImagesNote
For site migrations to the VIP Platform, importing a site’s intermediate files might be necessary to prevent broken links (404s) where links to specific intermediate files exist in the site’s imported database content. After the migration process, links to an image’s intermediate size array will be generated on the fly by the VIP File System.
After a site has migrated to VIP, when an image is uploaded through WordPress the VIP File System will generate URLs on the fly for the intermediate size array.
Overwrite existing files
--overwriteExistingFiles
Values not accepted.
By default, media imports do not overwrite existing files that share the same name and file path. Include the --overwriteExistingFiles option (or -o ) when importing media files to override this behavior and force the silent overwriting of an existing file that has an identical file name and path.
vip @example-app.production import media "https://www.example.com/uploads.zip" --overwriteExistingFilesAn error log file can also be downloaded within 15 minutes of the completion of the import process from a URL provided in message output in the terminal. The file can be accessed from a new URL by running the vip import media status command. The file will remain available for up to 7 days after the import or until a new media import is performed.
Last updated: December 12, 2025