Questions tagged [wp-handle-upload]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
19 views

Limit image resolution on upload file for specific field

I use Woocommerce ,when add product I have a form with two "upload file" fields. (product image field) and (product gallery images field). when the user uploads an image for the first field (product ...
0
votes
0answers
10 views

Limit image resolution on upload file for specific field woocommerce

when add product I have a form with two "upload file" fields. (product image field) and (product gallery images field). when the user uploads an image for the first field (product image field) I ...
0
votes
0answers
9 views

Wordpress Multisite images randomly gets 404 error

we have a Wordpress multisite and the images on the subsite randomly gets 404 errors (not all of them). When you upload multiple images in the media library, some will work fine while others will get ...
0
votes
0answers
16 views

500 Internal server error wp_handle_upload_prefilter

I get a 500 error after I've added the wp_handle_upload_prefilter to my plugin class. How I can fix this? require_once 'vendor/autoload.php'; class MyClass { public function __construct() { ...
0
votes
0answers
16 views

wp_handle_upload - specified file failed upload test

I'm using the wp_handle_upload() function to create a plugin that will give to the users the ability to upload files from front-end using ajax. I've solved an issue relative to an error in the syntax, ...
0
votes
0answers
11 views

Add upload progress bar for ajax upload form

Is there any way to add a progress bar to an ajax upload form in wordpress? I've searched here for a similar question, but I was not able to found nothing.
0
votes
0answers
23 views

How to upload Web-record Base64 Wave Audio file in WordPress Post (front-end form)

I created a WordPress post form that works well And I want to add a field: Browser recording audio file Based on base64 - (blob file) And upload when posting. My javascript code is : https://...
0
votes
0answers
20 views

Output file URI uploaded using wp_handle_upload

I'm uploading files into the WordPress upload directory, but I'm not able to display the uploaded file anywhere in theme (i.e. in single.php) My functions.php: if (isset($_FILES['uploadfile']['...
1
vote
1answer
29 views

Frontend submission upload image via external url

I have AJAX form to get movie data by movie id and post this data into new post. This is my function, It's works very well, But i can't upload image via external URL. // Image URL $poster = '//...
1
vote
1answer
50 views

how to retrieve uploaded url of zip files

following PHP code allow users to upload files frontend in wordpress I've searched hours but I could not manage to display URLs of uploaded files. I put in index.php <?php if ( isset( $_POST['...
0
votes
0answers
20 views

upload multiple images using wp_handle_upload

I have a form that users should upload multiple images but the code doesn't run correctly. This code works perfectly but when I add foreach to upload more images it doesn't work. it seems that $_FILES ...
1
vote
0answers
166 views

Missing a temporary folder.error when image is uploaded in admin Set temporary Directory - Wordpress 5.2.2

I am finding this error when I try to upload image in backend Missing a temporary folder. Tried setting temporary folder in wp-config.php with necessary permissions. Tried to set the temporary ...
0
votes
0answers
12 views

rescale too big images when downoaded

I am using download_url(), and wp_handle_sideload() to download images from a json feed. I need to check if the images are bigger than 4000px wide, and if yes, then scale it down. this is my ...
0
votes
1answer
539 views

wp_handle_upload specified file failed upload test

The code I am using is practically the same as the codex. The $u and $m return true. Just the $error gives "specified file failed upload test". Thanks for any help you can give. FORM: PHP if ($...
0
votes
0answers
19 views

Metabox Upload custom MIME file type not show in Media Library

I have made a theme to allowing uploading of files like GLB format to be used in WEBGL 3D rendering in a post. Here's the code for adding supported file type: function my_myme_types( $mime_types ) { ...
0
votes
1answer
308 views

How to trigger “wp_handle_upload_prefilter” filter when uploading an image programatically?

I am sanitizing uploaded SVG files with wp_handle_upload_prefilter, example: // Example code add_filter( 'wp_handle_upload_prefilter', function($file) { if ( $file['type'] === 'image/svg+xml' ) { ...
1
vote
1answer
28 views

Dynamically create Permalinks for uploaded files?

I have a custom page template, it lets users upload files using media_handle_upload() so everything is stored consistently in wp-content/uploads/20yy/mm/ I also store the filenames (and user_id, etc.)...
0
votes
1answer
147 views

How to upload .tex files in wordpress?

I am trying to upload tex files in my wordpress site. The methods I have tried and failed or the following. First of all the error I got is, Sorry, this file type is not permitted for security ...
0
votes
1answer
138 views

Handle image file and save it to media

I have function that gets uploaded file, save it, then crop it with imagecrop and now I need to save it again to the media. I know the way, how to do that with vanilla PHP, but I need file to be ...
0
votes
0answers
194 views

What is the hook to obtain the path and the name of the file that is being uploaded?

I work in a plugin in which I need to obtain information of the current file that is uploaded. To this end, in the plugin I use a filter as follows. add_filter('wp_handle_upload', '...
1
vote
0answers
47 views

Limit number of images to upload in wp.media function

I need to edit a plugin for my website. The plugin uses wp.media function and lets user upload images from the frontend. A user should be able to upload multiple images. But, I need to set limit on ...
0
votes
0answers
324 views

wp_delete_attachment doesn't delete image files / doesn't work

wp_delete_attachment should delete everything that is about attachment. However if I do wp_delete_attachment( (int)$delete_attachment_id, true ); The files remain on the server (even true should ...
0
votes
1answer
504 views

Rename image filename using 'media_handle_upload'

I need to rename images uploaded by the user when they post on my site. I have a code that works perfectly to save the image and make it part of the post. But I want the images to be renamed to have ...
4
votes
4answers
5k views

How to upload SVG in WordPress 4.9.8?

I tried uploading after installing different plugins. Even added a filter to functions.php file. function add_svg_to_upload_mimes( $upload_mimes ) { $upload_mimes['svg'] = 'image/svg+xml'; ...
0
votes
0answers
155 views

Remove multisite part from wordpress multisite upload directory

For multisite, there is shared (can be accessed from all sites) users and usermeta table, options table. So is there any shared upload directory? if not, is there a way to reliably remove multisite ...
1
vote
1answer
733 views

Email Attachment from Form Submit

I am currently encountering a very strange problem. With the help of two existing wordpress functions (wp_handle_upload and wp_mail) and a form that uses some custom ajax functionality to process my ...
0
votes
1answer
52 views

Add more field on WordPress media upload

Using WP drag/drop upload, the request payload (via Chrome DevTools) as below : ------WebKitFormBoundary Content-Disposition: form-data; name="name" butterfly.jpg ------WebKitFormBoundary Content-...
0
votes
0answers
124 views

File was uploaded, but it is not shown on media section of the dashboard

I managed to add an upload field to the user registration form of the website I'm building. I, also, was able to handle the upload. However, despite the file was correctly copied to the uploads ...
1
vote
2answers
2k views

How can I enable uploading excel files?

I have an old school user who wants to upload an excel file to our Wordpress page. Basically, Wordpress does not allow this. Upon https://gist.github.com/robwent/e3bf00bafe7a00bc3d0c4dceabde4fca ...
0
votes
1answer
1k views

Get uploaded image and attach it to the new post

What I'm doing: Publishing a post that has some of it's fields checked via AJAX. The problem: The images posted are not being saved. All the rest of the infos are. The image is not uploaded to the ...
1
vote
1answer
2k views

Media_handle_upload with custom upload folder?

I built a custom image uploader for avatars and I really like how media_handle_upload() creates different sized images. Since they're avatars, and not data for posts, I don't want them to be placed in ...
0
votes
1answer
629 views

Change wordpress default upload path to another domain

I have a domain, for example tarikhema.org. I want to change WordPress default upload patch folder to another domain for example dtours.net. How can I do this? My default folder is tarikhema.org/...
0
votes
1answer
463 views

Multi Photo Upload with Caption on Front End for Custom Post Type

I have a page template that allows users to create posts (for a custom post type) on the front end and upload (multiple) images. Currently it works fine but I would like to enhance it by adding the ...
0
votes
2answers
412 views

media_handle_upload fails with gravity form submitted image

Been stuck on this for a while now -- This function stopped working on a site I maintain recently, and I'm not sure exactly why. It is failing at the first media_handle_upload function and gives me ...
0
votes
1answer
503 views

How to restrict type/size of file uploads in any plugin?

I have a plugin, in this case it's Woocommerce Product Add-on which has an ability to allow folks to upload a file for the item being purchased. However, there is no restriction and I'm looking for a ...
1
vote
0answers
86 views

How to add upload video option in wordpress for user?

I have a website developed on WordPress.The website is basically job portal. Here in my website two types of user candidate and employer. In my website there is one signup form for both candidate and ...
1
vote
0answers
107 views

Wordpress media upload automatic refresh

I have added rotate image functionality in WP media upload. Image is rotating fine and saving is also fine, but when media upload popup is closed and opened again, it shows rotated image to previous ...
0
votes
2answers
38 views

Is it possible for a plugin to force reading and writing of uploaded images to a database instead of to a filesystem?

I am trying to configure a WordPress site using a server cluster and independent file systems. The problem is keeping the wp_content/uploads folder synchronized across all the server instances. My ...
1
vote
0answers
799 views

Show image crop window on image upload

I'm trying to add image from front end and crop it after upload. Used setState( 'cropper' ); to enable image crop window. It open the image upload window. Upload an image. But, Not open Image Crop ...
0
votes
2answers
623 views

Change file name on upload in Media Page

I trying to program the following rules: When attachment uploaded on wp-admin/post.php page, on the act of uploading, rename it to {post-slug}-{n}-[WxH].{ext} When attachment uploaded on wp-admin/...
1
vote
1answer
1k views

Getting all URLs of uploaded images using media uploader

I need to use WP media uploader to upload multiple images inside my plugin. I found this code which works fine for a single image. I've tried changing multiple: false to true, which enabled me to ...
1
vote
1answer
1k views

limit file type and file size using media_handle_upload

I have a front-end form that by using it, users can submit posts from front-end. everything is working great but I have one final problem. In my form I have a file uploader and I'm using ...
2
votes
1answer
1k views

Rename image during upload using date and time stamp?

I am trying to rename images during upload to avoid problems with image file names containig special characters and file names with non-latin characters. I found this function to rename images in ...
2
votes
2answers
13k 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="...
4
votes
1answer
4k 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
2k 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
1k 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
598 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
680 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 ...
2
votes
1answer
591 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($...