Handles uploads, sanitizes file names, checks file extensions for mime type, and moves the file to the appropriate directory within the uploads directory.

learn more… | top users | synonyms

0
votes
0answers
21 views

How get url of uploaded image in Wordpress (wp_handle_upload)

I added tab to admin menu page and input where it is possible to upload files. function logo_display(){?> <input type="file" name="logo" /> <?php echo get_option('logo'); ?>&...
1
vote
2answers
55 views

How to upload image from front end and save in media library?

I am working on a plugin .I want to upload image from front end i.e by input type="file".I did lot of google for it but could not upload image .Here is my code for uploading image <form method="...
3
votes
1answer
61 views

How to upload an image in the plugin's options page

My code is here.The other options working perfectly so how i can register the image and save the link in database and image in wp library. function register_team_show_case_setting() { //register ...
0
votes
2answers
35 views

Using $_FILES variable into the same function for uploading images and files

I want start saying that I'm learning and I'm trying to understand the use of $_FILES and $file_handler which are making me crazy into this function to upload attachments from a frontend form. What ...
0
votes
2answers
47 views

Upload images and attachments from frontend form

I'm not very expert of wordpress and I'm trying to create a frontend form sending information to my php function through ajax. I'd need help about uploading images and files as attachments of the post....
0
votes
1answer
17 views

How to adapt upload_dir to save files outside of WP uploads folder

We have a CPT which is used to manage various assets including image, pdf, CAD and other files. Our client would like to keep these asset files seperate from their other media files and does NOT want ...
1
vote
1answer
76 views

Get User's Facebook Photos as Wordpress Upload

I am new and a bit of troublesome on how Wordpress work as I have plan to use it as CMS for my commercial website. I have been figuring out on how to make an image that I have retrieved from user's ...
0
votes
0answers
36 views

Combine file rename function with file upload code

I have this code for upload files[images] : and I don't know how to combine with this function for rename file on upload from this post : File Rename function Thanks. case "window-image": ...
3
votes
1answer
74 views

Modify Maximum upload file size text

I have an issue with user uploading large images. I have prevented this with this snippet... add_filter('wp_handle_upload_prefilter', 'f711_image_size_prevent'); function f711_image_size_prevent($...
-2
votes
1answer
47 views

media_handle_sideload() fails

i am used the follow script what will upload an image by URL to wp, but it fails (debugging brings "The uploaded file could not be moved to wp-content/uploads/2016/03"). But i was wondering... the ...
0
votes
1answer
12 views

How to stop a post from publishing if the file upload is not a image/gif

This is the code and i want to stop the post publishing if the file is not an image Is this possible ? case "window-image": $format = 'image'; $title = esc_html($_POST['title_image'])...
0
votes
1answer
25 views

Troubles with code for upload a image

can someone give me please a code for image upload ? i try many but no one works , this is what i have : $post = array( 'comment_status' => $comment_status, '...
0
votes
0answers
17 views

media_handle_upload adds unnecessary extra records in wp_posts

So I created a form to have a user create or edit a post: title, metadata and an image. I use this to update the title: $my_post = array( 'ID' => $post_id, 'post_title' => $...
1
vote
0answers
43 views

wp_upload_bits Upload Specific Sizes Only

For images uploaded using this code, I want to only upload the full-size image and the thumbnail (whereas for images uploaded through site, I want all sizes). However, I can't figure out how to make ...
0
votes
0answers
38 views

Compression of original picture during upload?

WordPress compress scaled thumbnails of image during upload, but, original image will be is same quality. I am trying to compress original image too. I wish to make image in original resolution ...
7
votes
0answers
146 views

Uploaded images don't show in Media Library if there are special characters in IPTC Keywords

Some images that are uploaded to WordPress don't show up in the Media Library. The images get uploaded and even cropped to the defined sizes, there is an entry in the Media Library, but the preview ...
0
votes
0answers
202 views

Generate Thumbnails in wp_handle_upload

I'm developing my first plugin, and I use "wp_handle_upload" in order to modify images (with PHP) during their upload I'd like to do the same modification, also on the thumbnails generated by ...
1
vote
1answer
24 views

Handling email piping attachments and detecting unsupported file types

I have a plugin that I am working on which uses Email Piping. When an email is processed I want all the attachments from the email to be added to the WordPress Media Library. Currently I am using ...
0
votes
1answer
88 views

Uploaded image doesn't show up in media library

So, I'm uploading an image file which works with the following code however, it does not appear in the Media Library. I get a "File is valid, and was successfully uploaded" message but I must be ...
0
votes
0answers
32 views

How to replace attached media through programmatically?

I am not sure, whether the similar question exist before. I tried to get but , couldn't get the similar question. Actually I want to replace an attached media with new image. Which Means, I am ...
0
votes
0answers
267 views

AJAX image upload with a upload progress bar using media_handle_upload

I currently have post image upload for the featured image from front-end form. <input type="file" name="wh_image_upload" id="wh_image_upload" multiple="false" /> and using media_handle_upload ...
0
votes
1answer
263 views

Ajax image upload with media_handle_upload and form.js

I want to have AJAX image upload on front-end form and can't figure out where it goes wrong. HTML form for image upload <form id="thumbnail_upload" method="post" action="#" enctype="multipart/...
0
votes
0answers
42 views

Custom Wordpress Frontend Image upload - add description as post_content?

I have a form with 3 image upload fields. The Upload works fine and the images are attached perfectly. Now there's the problem that I have had to add a description field into the form - one for each ...
0
votes
0answers
71 views

Limit media upload to 4 files per user per day per user role

I'm setting up a (buddypress) site where users can upload media/images. I'm expecting a lot of file uploads and want to keep in control by limiting the upload to 4 files per user per day per user role....
1
vote
2answers
979 views

how to upload image using wp_handle_upload

hi i am new on WordPress can somebody tell me how can i upload multiple images using wp_handle_upload in a loop for($i=1;$i<count($_FILES['myfile']['name']);$i++){ ...
0
votes
0answers
25 views

Why wordpress can't generate metadata of big images

I have the following upload routine (compact): $movefile = wp_handle_upload( $file, $second ); ... $attach_id = wp_insert_attachment($attachment, $filePath); $attach_data = ...
0
votes
0answers
70 views

Custom upload directory for each file only for current plugin

I have a custom plugin to add project documents in my Wordpress site. Now these documents should be stored in their respective project folder such as: EN001/Document1.pdf EN001/Document2.pdf EN001/...
0
votes
0answers
463 views

PHP upload multiple files with different input field names using media_handle_upload

I'm trying to upload multiple images with different names from input fields on my WP site. The images will be attached to the post as metas. postThumbnail will be the post's featured image and ...
0
votes
1answer
116 views

Issue with wp_handle_upload

I am trying to upload a zip file from Setting Page. I have designed a setting page and in that I have a file upload functionality. I am using setting API to do this. My issue is: I know that maximum ...
2
votes
1answer
70 views

Disable drag and upload in Media Library

Does any one knows a valid/standard way to disable drag and upload when accessing the media library in the admin area? In order to make this sense to you, I'm building a multisite and user of sub-site ...
0
votes
1answer
951 views

Upload multiple image with media_handle_upload with multiple file field [duplicate]

I need to add multiple images with image descriptions form wp admin. Admin Form: <label for="image[]">Image</label> <input type="file" name="image[]"/> <label for="imgdesc[]"&...
0
votes
1answer
80 views

image upload error wordpress

i am trying to upload image it is uploaded successfully but when i tried to access it in phpmysql the link is somethig like this : http://localhost/job/?attachment_id=40 i want to store this image ...
0
votes
2answers
105 views

Custom Upload Adds Ghost File

I've tried this on a fresh install on the twentyfifteen theme. I'm adding a metabox to pages which allows uploads - Whenever I upload a file on a new Page it uploads the file but also adds another ...
0
votes
0answers
129 views

Replace upload system/Override wp_handle_upload

I am going to be running a WP site on Heroku, and none of the current solutions for the media library fit my needs. There is a system for Amazon S3 (not using because paid), and a mapping system for ...
0
votes
1answer
1k views

Change Wordpress Upload Folder using wp handle upload

Below code is for uploading file through a form ... I want to change the default upload path for the upload to a folder called abc in the root of my theme. I hope somebody can help me with this Below ...
2
votes
2answers
2k views

Modifying an uploaded image with 'wp_get_image_editor' and 'wp_handle_upload_prefilter'

I'm trying to intercept an image upload, resize it and then just let the upload continue. I'm using the filter wp_handle_upload_prefilter that passes as an argument a single file $FILES array. I ...
0
votes
0answers
713 views

How to resize an image server-side before upload?

I've been trying to resize an image client-side before uploading (see this question). I'm now trying to resize server-side before uploading. I think wp_handle_upload_prefilter is the filter I should ...
2
votes
0answers
779 views

How to resize image on client-side before upload?

I've been using Plupload to resize images on the client side before uploading them to the server. I've implemented a front-end form which lets the user select a file from their computer and submit it. ...
1
vote
0answers
121 views

frontend image post uploader

I've set up image uploader on front end custom form for users with some text input, textareas etc .Everything works fine, untill I decide don't upload any image. Then my "thank you" page gets blank. ...
1
vote
0answers
509 views

capability for upload on front-end (An error occurred in the upload. Please try again later )

We have a front-end form with wp-editor on front-end template page. Everything is working fine. but the only problem is "we can't add new images on front end form". there is an error "An error ...
0
votes
1answer
4k views

How to upload multiple images on frontend to ACF gallery using update_field

I'm trying to save images submitted on a frontend form in a way that they are accessible via the ACF backend. In how to upload an image on ACF with update_field on wordpress, someone provided a ...
0
votes
0answers
199 views

using media_handle_sideload() to add mp4 files to Media Library

For a site I'm building (for a client), I've written a shortcode, where the poster can enter [vine id="..."] followed by the ID of a Vine video. When the post is saved, my PHP functions will then go ...
-1
votes
1answer
498 views

wp_handle_upload Image sizes

What's the simplest way of getting wp_handle_upload To either change the size of the image it is uploading, or to get WordPress to generate the 3 sized images like it does in "crunching" when adding ...
0
votes
0answers
134 views

Wordpress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)

I have some code that uploads a file. I've tried both wp_handle_upload as well as regular PHP code and with both, it will claim it uploaded the files (wp_handle_upload returns an array with "url" and "...
0
votes
1answer
256 views

Upload file without attaching it to a POST

I've brought files with html file field and I'm trying to attach file to wordpress attachments using media_handle_upload $attach_id = media_handle_upload ( $file_handler, null ); the I've specified ...
0
votes
2answers
3k views

How Can I pass an image file to wp_handle_upload?

I have been looking everywhere for this and havent been able to find an answer. I need to pass a file from the url source to wp_handle_upload. How can I accomplish this? Thank you
2
votes
1answer
3k views

wp_handle_upload() - how to upload to a custom subdirectory within uploads

wp_handle_upload() works for me, but uploads files where it wants (uploads/year/month). Question: Is there any way to tell it to upload files to a custom dir (uploads/mycustomdir)? Or is there some ...
1
vote
0answers
243 views

wp_handle_upload: get custom checkbox value from media uploader

I found a snippet to add a checkbox to media uploader using action post-upload-ui Snippet found here /** * Add checkbox to set autocreate on upload */ function ...
0
votes
1answer
236 views

upload file with front-end submission and forward the data in an email

I have an email set up using wp_mail that forwards my front-end submission data as well as posting it to the dashboard. The part that I am having trouble with is forwarding the attachment file with ...