How Can I pass an image file to wp_handle_upload?

wp_handle_upload() is made to handle, well, uploads. It expects upload-related inputs.

To “upload” image from remote URL there is media_sideload_image(). Since you actually don’t specify type of your file, you might need to tinker some yourself, using this function as an example.

Leave a Comment