This include all question concerning the process of uploading file, whether from the WP Admin Pages or from a front end editor.

learn more… | top users | synonyms (4)

2
votes
2answers
767 views

wp_delete_attachment doesn't delete images in wp-content/uploads/

My function lets users delete their uploaded images in the front-end. However, they're only deleted in the Media Library. That means that they're still in wp-content/uploads/. public static ...
1
vote
3answers
67 views

Get attachment ID of author_meta image - Attachment Metadata

I've created a custom field in user profile where upload a profile image. It's very simple. To create fields I've used: add_action( 'show_user_profile', 'cover_image_function' ); add_action( '...
0
votes
0answers
6 views

How to prevent script from updating each image in Custom Image Widget

I found this create question here where you can create a custom image upload widget. Everything works great except as the disclaimer in the answer mentions every time an image is updated (if multiple ...
4
votes
1answer
1k views

wp_generate_attachment_metadata returns empty array

foreach ($_FILES as $key => $file) { $uploadedImage = wp_handle_upload($_FILES[$key], $upload_overrides); pre_r($uploadedImage); if (!isset($uploadedImage['...
0
votes
1answer
755 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
10 views

get_attached_file returns wrong path after changing media upload dir

I've changed the default WordPress media upload dir (http://example.com/wp-content/uploads) to (http://example.com/uploads). Everything is OK and media files are uploading and showing correctly. But ...
1
vote
1answer
432 views

Upload a json file in php

I'm trying to upload a json file through PHP. This is the code that i have yet. if( isset( $_POST['upload'] )) { $target = "/"; $target = $target . basename( $_FILES['upload']['name']) ; ...
1
vote
2answers
61 views

How to hide CPT files from media library programmatically

We have created a CPT which allows our customer to upload files from the admin page to a folder outside of the wp-content/uploads folder. Files are uploaded and manipulated using wp_handle_upload and ...
0
votes
2answers
417 views

Unable to upload images using the Media Library

I have had a site that has been working perfectly for the past few months. Then all of a sudden when I go to upload an image via the Media Manager on the Admin Dashboard I get a 500: Internal Server ...
1
vote
1answer
47 views

WP Media uploader loading only once in options page

A weird issue happening with me which I am unable to fix. In my theme options page, I added options to upload images one for logo and another for backgroud image. Here is my HTML <table class="...
0
votes
3answers
542 views

How to check if uploaded file is .pdf not .jpeg?

I use a function in my theme that prevents upload of big size image files (thanks to @fischi), but I want to apply it strictly to .jpg/.jpeg files only, because it prevents to upload .pdf files too. ...
0
votes
0answers
7 views

How to get the return value of wp.media({ frame: 'post' }) in all cases?

When the user is in an edit.php page or post-new.php, the wp.media global is available and I want to use it to open a special insertion view that allows videos. var frame = wp.media({ frame: '...
-1
votes
0answers
8 views

Why is my add media button showing the current page?

Im modifying the my account page for Woocommerce and I have a problem, I have managed to integrate a media upload button to the my account page in Woocommerce but when clicking on it, it just opens up ...
0
votes
2answers
419 views

Remove Media File Items From Server That Do Not Exist in Media Library

Pretty much as the title suggests I have items on my server (images mostly) that do not feature anywhere in the media library. What is the best way to delete these? Is there a plugin or would I need ...
3
votes
1answer
498 views

WP3.5 Media Uploader - how to make it accept multiple images?

I'm wondering how to make WP3.5 media uploader return 2 or more items in attachement? It always runs once even if 2 items are selected. The code: $('.button').on('click', function(){ var ...
2
votes
2answers
881 views

What might cause a POST to wp-admin/async-upload.php to return JSON >and< HTML?

In the media tab, upload of a valid image file results in display of "HTTP error". Reload of the media tab shows that the image did upload and resize, though. Browser debug tools show that on upload,...
0
votes
2answers
11 views

Check if author or uploader id of the attachment(uploaded) image is match?

I am trying to write a function to upload and delete images on frontend with dropzonejs uploader, and so far i managed to make everything work. But the problem is that i need to secure it that the ...
3
votes
1answer
202 views

Refresh wp.media after ajax call

I'm building a plugin where I add a tab to the media manager and can add stuff from another source. I add the tab with this, which generates a iframe: add_filter('media_upload_tabs', '...
1
vote
2answers
464 views

How to decrease the file size upload limit?

How do I decrease my media file size upload limit from 20 MB to 500 KB? I actually tried to follow the solution used in Decrease file size upload in Media but got a "undefined add_filter()" error. I ...
2
votes
1answer
756 views

How to hook into wordpress admin upload iframe?

I have written a plugin which lets the user upload file attachments for using WordPress as a download site. So I have added a meta box which shows the user the files he has uploaded for every post. ...
1
vote
1answer
1k views

The uploaded file exceeds the upload_max_filesize directive in php.ini

I'm trying to upload a XML file through Wordpress Importer It shows this error, no matter what the size of the file is. Even 10kb file throws up this error. My php.ini settings were set to 100MB, ...
1
vote
2answers
971 views

Wordpress 3.5 Media Uploader - Only allow 1 upload and certain file types

I am trying to include the new WP Media Uploader in a Custom Meta Box. I found this tutorial. However, I am looking for a way to limit the uploader to only accept certain types of files like '...
0
votes
0answers
92 views

Uploading .mp3 files http error - 2 “exact” files one successful other fails

I have 2 equal .mp3 files - technically different files but both exported from Audacity using the same settings and the same original audio. Exactly the same size, same content (albeit processed ...
0
votes
1answer
19 views

Where to add my code to auto attach images to existing products

I've got this code from an answer to a previous question: add_action('add_attachment', function( $attachmentID ) { if ( ! class_exists( 'WC_Product' ) ) return; // if no WooCommerce do nothing //...
0
votes
1answer
13 views

Callback Function Not Firing On Selection In Media Uploader

I'm studying theme development and am working on some code for a media uploader that can be used to add a picture. The file frame is opening (and I've called wp_enqueue_media(); for that to be the ...
2
votes
1answer
181 views

Resize the WP media Uploader iFrame

I'm trying to customize the look of the iframe that pops up (media uploader). I've manage to remove some fields etc, but I cannot re-size the frame. Does anybody know how to do this?
1
vote
1answer
483 views

Add select field to media uploader that adds a class to the image

I'm looking for a way to add a <select> menu to the media uploader that will have two options: normal image, which will do nothing, and profile image, which will add a CSS class to the image if ...
1
vote
1answer
777 views

Why does my functions.php cause white-screen and media-library issues?

Overview: I was authoring a child-theme, and realized that functions.php was causing problems with the media-library and caused a "white-screen" to appear after editing a post. I fixed the issue by ...
0
votes
1answer
701 views

Automatically Add Caption in image

I want to automatically add caption for each picture appears in the name of the image or the alternative text example Caption add automatic
5
votes
1answer
810 views

Upload path/URL weirdness for the main blog of a multisite/network setup

We have a WP network (with domain mapping) that was started pre WP 3.5, so it was using ms-files.php and wp-content/blogs.dir/ to store media files. I wanted to remove ms-files.php dependency and ...
1
vote
3answers
554 views

How can one update a theme on a live site without interruption?

So i have a WordPress-based site with a custom Genesis child theme. Once the site goes live, we are obviously going to need to make changes periodically to the child theme's code — modifying CSS and ...
1
vote
1answer
657 views

How to: wordpress job listing and candidates details

I am developing a wordpress site (http://new.saffronresourcing.com/candidates/) where candidates who wants to apply for jobs will be able to upload their cv along with their personal details. I ...
3
votes
2answers
19 views

Delete images uploaded by 'Subscriber' role

I've inherited a very poorly designed WordPress site that in part uses BuddyPress for a directory type section. Users are able to upload profile images and 'product' images to their profile. As a ...
0
votes
2answers
2k views

Uploaded images do not show on localhost

I'm working with Wordpress 3.3.1 on a local installation. I've uploaded an image file and it doesn't show up. The base directory is a symbolic link /var/www/wordpress/ that leads to /usr/share/...
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 ...
0
votes
0answers
52 views

Wordpress monthly upload directory owner set to root

This is a weird one. Wordpress by default stores uploaded media in monthly sub-directories of the uploads directory. Eg wp-content/uploads/2016/07/ On one of my sites, this directory's owner gets ...
0
votes
1answer
1k views

How to delete file uploaded by Plupload

I follow the steps from here to integrate the plupload in metabox. Everything is working fine. But I did find one disadvantage of this guide. When I click the 'Remove' link from the uploaded images, ...
0
votes
1answer
473 views

Insert image in comment reply

I have searched everywhere but can not find a plugin that allows users to upload an image into their Reply to a comment. It is a photographic blog so has to have this ability. I did try a couple but ...
0
votes
2answers
2k views

Get image post ID in media upload

I am developing a plugin that adds a Custom Post Type to my theme. It's a retail directory and the post type is a retail listing. Everything is working fine. I can upload content to the DB and then ...
0
votes
1answer
430 views

Wordpress creates unused (unregistered) image sizes

I have a news blog created on WordPress. I've set up WordPress to create 3 resized versions of images when uploading them. 315x215(featured image with cropping option enabled) 620x (to create images ...
0
votes
0answers
15 views

Multiple file upload frontend and capture their paths

<input name="image_url" type="file" /> <input name="Submit" type="Value" value="Přidat" /> I have this in html form and this in php : if ( $_FILES['image_url']['name'] != "" ) { ...
3
votes
1answer
954 views

Remote upload file to server B

I'm aware this might be some of the hardest coding to do ever, but thought of giving it a try. Im basically trying to detect all (mp3) filetypes uploaded through the Wordpress media upload and send ...
0
votes
1answer
2k views

Embed HTML5 files/subfolders in post?

I am attempting to publish an Adobe Captivate project to a WordPress blog. The .swf file is easy enough to handle, but the HTML5 version is giving me problems. The way that Captivate outputs HTML5 is ...
9
votes
0answers
289 views

Physical organization of wordpress media library (Real Media Library plugin)

Introduction. In the above screenshot you can see a folder structure built with premium plugin Real Media Library. Now i want to create an extension plugin which can organize the folder structure ...
-1
votes
0answers
10 views

With only one button, Can I upload image to media directory?

I searched and found some ways to upload images to media directory. They all need several elements. That is, one browser button, one is upload button. Can i only use one button to upload? So if i ...
4
votes
1answer
10k views

Use Media upload in custom widget on wordpress 3.5

I'm creating a small widget for wordpress 3.5 that allows you to upload images. The widget is loaded correctly by wordpress. When I add the widget to a sidebar upload button does not work. If I ...
1
vote
2answers
692 views

Retrieving JSON data in ajax request from media uploader

I'm having some problems getting my JSON data that's being passed via an ajax request. I'm trying to implement the media uploader into a plugins settings page. I've got it functioning properly using ...
7
votes
2answers
8k views

Image Upload from URL

I really like the way SE uploads an image from a URL (I'm sure many do!). I've been searching, but can't find, is there a plugin or a method similar to this available for WordPress? I know an image ...
6
votes
1answer
117 views

Uploading media with the REST API

I am having trouble when uploading media to a WordPress site with the JSON REST API. With the following code I can upload the photos, but no info is assigned to them, not even the name - in fact the ...
2
votes
1answer
31 views

How to disable Wordpress Media resize different size version?

When i upload to a media, Wordpress is resize it to many version like that 2016-04-03_23-36-35-90x65.png 2016-04-03_23-36-35-120x80.png 2016-04-03_23-36-35-360x240.png 2016-04-03_23-36-35-480x320....