php – Only the first image uploads

Question

I am trying to upload these two images to my site:
https://listing-images.homejunction.com/maris/82721628/photo_1.jpg
https://listing-images.homejunction.com/maris/82721628/photo_2.jpg

But only the first image works. I am using the following code, where $post_id is the post to attach these images to:

media_sideload_image( 'https://listing-images.homejunction.com/maris/82721628/photo_1.jpg', $post_id, '','id' );
media_sideload_image( 'https://listing-images.homejunction.com/maris/82721628/photo_2.jpg', $post_id, '','id' );

I have tried other methods of uploading and attaching images, but the upload seems to always fail. I can upload photo_1 multiple times, but photo_2 does not work. Either it doesn’t upload at all or it’s a blank image.

How can I get both images uploaded and attached to a post?

0
Cyrus Vorwald 2 months 2021-05-08T16:43:56-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse