Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
24 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
16 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 ...
1
vote
0answers
78 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
1answer
16 views

Use a filter from a class function?

How can i use add_filter within a class function? this doesn't seem to work class ClassA { .... function my_custom_upload_dir($dir) { return array( 'path' => ...
0
votes
0answers
7 views

Attach previously uploaded file to post

I am working on a script to upload data to a create a post with an (already uploaded) file attached. The file is located in the wp-content/uploads folder, but not added to the media array. How could ...
0
votes
0answers
35 views

Allowing images only when uploading files

I want to allow users to upload .jpg .png and .gif files only. I've tried hooking to the wp_handle_upload_prefilter filter like this: function custom_upload_filter( $file ) { $mimes = array( ...
0
votes
0answers
43 views

how to dynamically access file upload fileds

in my custom plugin i wrote a php file for displaying a table in front end. and the datas used to display in that are taken from db and i added a input file upload field also but the file uploading is ...
1
vote
0answers
64 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
0answers
56 views

Using 'add_attachment' to add taxonomy term on upload completion?

function amend_gametitle_upload( $game_title ) { global $post; if ( isset( $_REQUEST['post_id'] ) ) { $post_id = absint( $_REQUEST['post_id'] ); $post_obj = get_post( ...
1
vote
0answers
228 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
1k 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
95 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
209 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
74 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
99 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
767 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
345 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
145 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
0answers
44 views

What kind of security does wp_handle_upload() provide?

According to the docs, wp_handle_upload(), will: Handle PHP uploads in WordPress, sanitizing file names, checking extensions for mime type, and moving the file to the appropriate directory within ...
0
votes
0answers
53 views

Wordpress CPT Upload Audio Files to wp-content/upload/audio

I'm working on a custom post type for my blog that will read files in the directory specified and create a post for that file. I also want to use the wp upload handler in my custom post type but I ...
0
votes
1answer
111 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 ...
3
votes
1answer
700 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
83 views

Frontend image uploading from frontend cant handle hebrew names

i'm using the insert_attachment code in my functions.php : function insert_attachment($file_handler,$post_id,$setthumb='false') { // check to make sure its a successful upload if ...
3
votes
1answer
289 views

Modify image while uploading

I have a plugin which uploads image using wp_upload_handler here is a function: //handles upload, a modified version of bp_core_avatar_handle_upload(from bp-core/bp-core-avatars.php) function ...
0
votes
1answer
74 views

Image upload and crop in wordpress

I am new to wordpress and buddypress plugin. I want image upload and crop functionality in a new page. How can I do this. I searched over the internet and couldn't able to find a tutorial to do this. ...
1
vote
1answer
530 views

Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”

Good morning, I am trying to change name format that Wordpress uses to rename uploaded files. As I upload an image whose filename is "desert-landscape.jpg", Wordpress will set up scaled versions and ...
0
votes
0answers
73 views

plugin: alter “crunching…” text, reject the upload, and other logic

I am new to wordpress, but a customer wants one of my scripts converted into a wordpress plugin. The basic idea of the script is when a file is uploaded with a specific filetype, then start decoding ...
0
votes
1answer
1k 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 ...
3
votes
1answer
562 views

Changing upload directory for plugin uploads only

I've spent a lot of time reading the other threads on this question, but I just cannot get my code to function properly. I'm building a plugin, and I've set up an upload form on my custom admin page, ...
0
votes
1answer
198 views

WordPress front-end media (image) upload ERROR!

I pasted my codes HERE in Pastebin. Thing is that, I have posts, where the post thumbnail is the first image and the custom fields are used to store the other 3 images of the post. The form fields ...
0
votes
1answer
282 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 ...
0
votes
1answer
301 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
2answers
880 views

Custom image upload

I'm trying to setup upload for for attachments for my custom post form. At first I add to my form tag enctype="multipart/form-data" For testing purposes I have two upload forms, but in future I'm ...
1
vote
0answers
260 views

Upload video in custom folder

I am trying to find a system to upload some kind of media in a custom folder. I want to keep all uploads in default wordpress folder and create a custom folder just for videos. So i would have the ...
2
votes
1answer
595 views

rename attachments based on parent-post-title on upload

I know there a some functions already avaible here for this task, but none of them seem to work as needed. The best way seems to me adding a filter to wp_handle_upload_prefilter like kaiser does in ...
0
votes
1answer
700 views

Upload an image at frontend > Create direction and/or rename filename possible?

I have a form for a non-profit-club, that publish posts + up to 20 images. The image-path will be writen in a custom-field. Images are uploaded. Ok, now i want to rename the pictures or (much better) ...
0
votes
1answer
632 views

Image upload and path to custom field

I build a script, to post from frontend. There are many custom-fields. Most works fine, but with one thing i have problems. First a description, then the script. It seems like, that images won't ...
2
votes
1answer
2k views

Rename image uploads with width in filename

I am attempting to change the name format that Wordpress uses to rename uploaded files. For example, when I upload an image with filename "cat-picture.jpg" Wordpress will create scaled versions and ...
1
vote
1answer
494 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 ...
0
votes
1answer
1k views

Using wp_handle_upload and media_handle_sideload with ajax

I'm struggling to figure out how to use wp_handle_upload() with ajax when processing a form. What I'm doing here is using a form to allow users to edit posts from the front end so they can do some ...
4
votes
2answers
2k views

How to change upload directory in wp_handle_upload

I am trying to work out how to use the wp_handle_upload function for a custom plugin so that i can specify my own own upload directory. The code so far takes a file from my plugin settings page and ...
1
vote
1answer
4k views

wp_handle_upload - The uploaded file could not be moved to wp-content/uploads/2012/09

This is the code I am using to upload the file to WordPress define(‘WP_DEBUG’, true); $filename = "test.png"; $tmpFile = download_url("http://url.com/testing/crop/".$filename); chmod($tmpFile, ...
1
vote
1answer
636 views

Upload images with comment

EDIT: I finally got the right answer; see my own answer beneath this post for everyone that's interested. After searching for a couple of days and trying over and over again I really got stuck. ...
1
vote
2answers
945 views

Disable image resizing on specific upload fields

I am using the Options Framework Theme from devinsays, but am having a "small" problem with the Image Upload functionality. Basically, I need to disable resizing on a specific upload-field, but keep ...
2
votes
2answers
2k views

How to set file type in wp_handle_upload?

I'm using wp_handle_upload to allow users upload .csv files in the front end and it's working fine. I was wondering how can I limit this to only allow .csv files though since currently it accepts a ...