how to get links to the file uploaded
-
I want to let my website user to upload files in a form and then send them attached to email. HOwever I cant find way to get links to those files. I used this code
$attachment_links = array(); $attachments = get_posts(array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' =>'any', 'post_parent' => $post->ID )); if ($attachments) { foreach ( $attachments as $attachment ) { echo apply_filters( 'the_title' , $attachment->post_title ); $attachment_links[$attachment->ID]=the_attachment_link( $attachment->ID , true ); } } wp_mail( $emailTo, $subject, $body, $headers, $attachment_links );
But that doesnt work. Actually the file being uploaded do not get attached to the post.
https://www.ads-software.com/plugins/wp-multi-file-uploader/
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘how to get links to the file uploaded’ is closed to new replies.