S3-Uploads
S3-Uploads copied to clipboard
Warning: copy(): The second argument to copy() function cannot be a directory in /var/www/html/wp-content/plugins/s3-uploads/inc/class-s3-uploads.php on line 226
When using the plugin and using the upload manually, $upload = wp_handle_sideload($file, array('test_form' => false));
I am getting an error. The second argument passed in to copy
is the temporary file name, so I don't know why it is complaining. If I add a file extension, then it works.
I have managed to by-pass the problem with the following filter;
function wp_check_filetype_and_ext($wp_check_filetype_and_ext, $file, $filename, $mimes, $real_mime) {
if (is_array($wp_check_filetype_and_ext) && array_key_exists('ext', $wp_check_filetype_and_ext) && array_key_exists('type', $wp_check_filetype_and_ext)
&& $wp_check_filetype_and_ext['ext'] === false && $wp_check_filetype_and_ext['type'] === false) {
// broken because of the S3 location.
if (strpos($file, 's3://') === 0) {
return wp_check_filetype($filename, $mimes);
}
}
return $wp_check_filetype_and_ext;
}
add_filter('wp_check_filetype_and_ext', 'wp_check_filetype_and_ext', 10, 5);
Is this still an issue in the latest version of the plugin?