Here’s a quick fix:
$dir = wp_upload_dir();
$dirname = 'featured_image';
$full_path = $dir['basedir'].'/'.$dirname;
$baseurl = $dir['baseurl'].'/'.$dirname;
$filename = explode('/',$file_url);
$file_split = count($filename);
$nofun_allowed = preg_replace('/[^a-z0-9._-]/', '-', $filename[$file_split-1]);
$filepath = $full_path.'/'.$nofun_allowed;
$fileurl = $baseurl.'/'.$nofun_allowed;
if(is_dir($full_path)){
$smack_fileCopy = copy($file_url,$filepath);
}
I use preg_replace because it’s easier then url-encode/decode and the original filename is not really needed.
I fixed 3 issues in this plugin, now you can buy me a beer 🙂
I am pulling my hair out with this. 10000 products no images do you have the csv your using. Help would be greatly appreciated and I will buy u a beer
I tried your code but filename and type in featured_image folder are just dashes ———————————- Not sure about that
Here’s a copy of what I’ve come up to: http://ge.tt/37jlxed/v/0?c
Your filenames probably contain [only] non-ascii characters (like Chinese or something) and what I basically do is to replace all non-alphanum with dashes to there are no spaces or other characters that need to be converted to %20 (or the corresponding hex representation).
An additional improvement that would be also needed is to add a timestamp to the filenames. It’s needed because the plugin doesn’t check the uniqueness of the filename right now and by uploading an image with the same filename it would get overwritten.
Can you send me a .csv file that you are using so I can see how you constructed it. Thanks in advance
wp-content/uploads/featured_image/—-.JPG this is what I get when its imported?
what’s the original url/filename that you’re trying to upload?
The filename seems to be OK, I don’t know what’s the cause of your problem. Sorry :-/
New version is released with improvements and fixes. Please upgrade and leave your feedback. Hope it works well as expected.