Remote file with space in file name – solution to properly import
-
Hi!
To import a remote media file with meta key _wp_attached_file that has spaces in its file name you need to specify <wp:attachment_url> with %20 in stead of space to get the remote server to understand what file you want to import. The rest of the parms need to be set sanitized (i.e. space becomes a dash).
For example file name: test%20file.jpg
Resulting file name after successful import will be test20file.jpg.A small update in wordpress-importer.hhp will solve this problem.
Function fetch_remote_file replace
// extract the file name and extension from the url $file_name = basename( $url );
with
// extract the file name and extension from the url $file_name = str_replace( '%20', '-', basename( $url ));
and the import is like when you have uploaded the file directly into WP.
Please incorporate this fix in the next version of importer.
- The topic ‘Remote file with space in file name – solution to properly import’ is closed to new replies.