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
22 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'); ?>&...
0
votes
1answer
736 views

Specified file failed upload test. Error When Uploading Image From Front-end

This is my code: $file_return = wp_handle_upload($_FILES['my-photo'], array('test_form' => FALSE)); if(isset($file_return['error']) || isset($file_return['upload_error_handler'])) { echo "And ...
1
vote
2answers
57 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="...
0
votes
1answer
2k views

wp_handle_upload returns empty error array

I am trying to do an upload via ajax and really dont want to use the regular wordpress media uploader. It is too much stuff and all i want to do is upload single image. I have everything working the ...
1
vote
1answer
725 views

Organizing uploaded media with wp_insert_post() and wp_handle_upload according to time parameter

I'm retroactively creating a post with wp_insert_post() and attaching a featuring image to it. I need the image to go into the folder that corresponds to the post's publishing date. I'm using time ...
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
38 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
50 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
19 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
77 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": ...
7
votes
0answers
154 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 ...
3
votes
1answer
75 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 ...
0
votes
1answer
268 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
203 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
26 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
89 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 ...
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 ...
0
votes
0answers
33 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
274 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 ...
-1
votes
1answer
502 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
44 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
1k 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
466 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
117 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
71 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
969 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
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
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 ...
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
2answers
106 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
0answers
780 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. ...
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 ...
3
votes
1answer
2k views

Image resize with image url

I am using wp_handle_upload() to allow users to upload the images in back-end and I want to re-size images to a custom size before uploading it. Is there any way without using any plugins or so to ...
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. ...
0
votes
1answer
641 views

How to use getimagesize() of image upload?

I need to check the resolution of an image I want to upload via media box, and then upload it into a custom directory. As a starting point I used part of the code from How Can I Organize the Uploads ...
1
vote
0answers
510 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 ...