Open jmarx opened 4 years ago
I don't think we've seen any issues with sideloading images at all, at least not to my knowledge.
In this case, it seems like the issue is from is_readable( $file['tmp_name'] )
failing. That tmp_name
should be set to a path returned from download_url()
which uses wp_tempnam()
and get_temp_dir()
. The temp directory isn't affected by S3 Uploads, so it's possible this is server configuration on your side; can you check what get_temp_dir()
returns and whether that location is writable?
@rmccue
'/tmp/'
I am getting this in response from that function.
I should add that these failures only occur during AJAX calls. We experience no issues when using this function in any other context.
Very strange.
I wonder if S3 Uploads is moving the file too early? If you can dig in and debug what's happening when it runs that check, please do (removing the @
might reveal some silenced errors from S3 Uploads too).
Has anyone else seen an issue when trying to use
media_sideload_image
inside a wp ajax call in conjunction with this plugin?I tried even the most simple image upload inside a barebones ajax call.
I keep getting this error:
'Specified file failed upload test.
https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/file.php#L815The only way I can get it to work is to remove this filter: remove_action( 'wp_handle_sideload_prefilter', array( $s3, 'filter_sideload_move_temp_file_to_s3' which of course defeats the purpose of using the plugin in the first place.
@rmccue Do you have any thoughts on this?
FYI, the image uploads work in every use case except for the ajax call.
Thanks in advance for any feedback you guys may be able to provide!