pods_attachment_import uploading wrong and without extension
-
Hello I’m trying to create a new custom post using a frontend custom form with file upload.
I have setup a field under the pod fields. Following the example on pods docs
$pod = pods( 'candidato' ); $url_of_image = 'https://placekitten.com/400/600'; $attachment_id = pods_attachment_import( $url_of_image ); if ( $attachment_id ) { $data = array( 'post_title' => 'My item', 'my_image' => $attachment_id ); $pod->add( $data ); } else { echo 'Image not imported, try again.'; }
This returns
Image not imported, try again
because the return frompods_attachment_import
returns 0. The image is uploaded under uploads/2021/12 without extension. Also, the image is not listed on the media library and no sizes are created, I have only a file named 600 (the end of the URL https://placekitten.com/400/600).I don’t know what I’m doing wrong.
Any help will be appreciated. Thank you.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘pods_attachment_import uploading wrong and without extension’ is closed to new replies.