Skip to main content

Questions tagged [uploads]

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

Filter by
Sorted by
Tagged with
105 votes
4 answers
86k views

How to Protect Uploads, if User is not Logged In?

I use WordPress for a private site where users upload files. I use the "Private WordPress" to prevent access in to the site if the user is not logged in. I would like to do the same to the files ...
chifliiiii's user avatar
  • 2,852
67 votes
2 answers
114k views

How can I add an image upload field directly to a custom write panel?

I've added a new page under "Pages" in the wordpress admin, and added several custom fields. I'd also like to be able to add an upload image field to the page editor - is there some way to do this via ...
Will's user avatar
  • 893
21 votes
2 answers
62k views

Add "upload media" button in meta box field

I have a custom post which has a meta tag that needs to be using a file upload (for video files). I am wondering, what is the correct way of adding an "Upload" button that points to the WordPress ...
SpyrosP's user avatar
  • 515
8 votes
3 answers
9k views

How Can I Organize the Uploads Folder by Slug (or ID, or FileType, or Author)?

I want to store all attachments (media) in folders named with each post title. Example: /wp-content/uploads/my-post-about-stuff/ The folder should contain all media attached to that post. Is that ...
user3047's user avatar
  • 546
30 votes
6 answers
207k views

How to Fix HTTP Error When Uploading Images?

I am using WordPress 3.4.1 on Ubuntu 12.04 using Apache and PHP 5.3.X When I login to the dashboard and add a new post. Then try uploading an image to set as a featured image, I get a red box with a ...
Michael Ecklund's user avatar
18 votes
2 answers
27k views

How to Require a Minimum Image Dimension for Uploading?

I need a way to restrict authors from uploading images bellow specific dimensions. Say I only want to allow uploading images that are at least 400px x 400px. If the image size is smaller, the author ...
boruchsiper's user avatar
25 votes
4 answers
4k views

Trigger refresh for new media manager in 3.5

I'm trying to figure out how it's possible to 'refresh' the media library in the new media dialogue in 3.5. I'm adding images from an external image library to the WordPress library (via a tab/iFrame ...
Richard Sweeney's user avatar
21 votes
1 answer
8k views

Limit image upload to one and disable audio, video and other document file types to upload

Somebody knows some trick in Add new Post to: Disable the upload of audio, video and other filetypes. Only accept the upload of an image (jpg, png, gif). Limit the upload of each Post to only One ...
José Pablo Orozco Marín's user avatar
10 votes
5 answers
27k views

How to restrict access to uploaded files?

I have a restricted area on a website that can only be accessed by logged in users. For that I created a page template with a 'current_user_can()' condition. My problem is that the documents attached ...
mike23's user avatar
  • 5,991
8 votes
3 answers
6k views

How to assign multiple file-mime-types to extension?

To allow extra file types for upload, we use: add_filter('mime_types', 'my_mimes'); function my_mimes($all) { $all['zip'] = 'application/zip'; return $all; } But how to assign multiple file ...
T.Todua's user avatar
  • 5,810
16 votes
3 answers
35k views

How to set featured image to custom post from outside programmatically

I am trying to fetch and insert images outside the wordpress environment to a custom post via PHP. How to move/upload that image to wordpress upload directory year date folder format just like ...
Faisal Shehzad's user avatar
15 votes
2 answers
11k views

Change upload directory for PDF files

I would like to change the upload directory for PDF files only, not for other files. For example, the PDF files would be uploaded to wp-content/uploads/pdf but other files would remain in wp-content/...
Sinklar's user avatar
  • 191
11 votes
5 answers
5k views

Each custom image size in custom upload directory?

I want to upload my custom image sizes in custom folders. The folder should have the name of the selected width. For example: If I add these custom sizes... add_image_size('custom-1', 300, 9999); ...
Philipp Kühn's user avatar
7 votes
1 answer
7k views

Rename files during upload using variables

I'd like to rename files during upload and set their names to the post slug the files are being attached to, plus some random characters (a simple incremental counter will de just fine) to make the ...
pereyra's user avatar
  • 475
1 vote
1 answer
2k views

exposing attachment uploading to the front end -- delicate

i'm probably breaking a few common sense rules here. is there a way to utilize wordpress' bake in attachment file handling for an upload form within a theme template? yes, the front end -- i ...
Jonah Goldstein's user avatar
24 votes
4 answers
67k 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 ...
Travis Pflanz's user avatar
12 votes
2 answers
49k views

Submit post and upload image from front-end

I am trying to do something similar to the above question. I am trying to make users post and upload images from front-end. I have already done the post form and its working. I just followed and ...
Govnah Antwi-Boasiako's user avatar
9 votes
1 answer
23k views

Upload post thumbnail from the front end

We would like users to be able to upload the post thumbnail when editing posts. How would this be done. I would imagine it would make use of the ajax functions of wordpress. Any ideas, Marvellous
Robin I Knight's user avatar
9 votes
2 answers
8k views

Give users a maximum upload capacity; limit the number of files a user can upload OR limit the number of files per upload

I'm using the Media Library on the front end of my website and I'd like to stop users from being able to spam my server by uploading an unlimited number of files. As such, I'd like to do one or maybe ...
turbonerd's user avatar
  • 1,237
8 votes
2 answers
4k views

Handling front-end file uploads, considering safety and ease of use

I'm looking to adapt an existing forum-like plugin which has no facility for attaching media. The plugin works as a Custom Post Type, so it would be as "simple" as attaching an image to a post. I am ...
turbonerd's user avatar
  • 1,237
5 votes
2 answers
2k views

Differentiate Featured Image from Post Images upon Upload

I want to differentiate the featured image from post images. The plan is to give the Featured Image multiple sizes, but the images inside / connected to the post only needs the default sizes. I ...
Howdy_McGee's user avatar
  • 20.7k
2 votes
2 answers
6k views

Automatically wrap post image in div

In regards to image attachments inserted into a post, I would like to wrap the img tag inside a div tag for specific design purpose. Is there a way to do this automatically after attaching the image ...
Giraldi's user avatar
  • 1,465
22 votes
11 answers
28k views

How to generate thumbnails when needed only?

I have 1000 images. How can i make wordpress to generate thumb only when needed. For example home slider will only use 10 images i dont want the other 1000 images have that thumbnail generated as its ...
chifliiiii's user avatar
  • 2,852
21 votes
6 answers
26k views

No Thumbnails Generated

I setup WordPress on my own server and it's up and running...one thing that I have noticed is that WordPress doesn't generate any images I upload. Usually when I upload an image through WordPress it ...
Josh Rodgers's user avatar
  • 1,173
16 votes
5 answers
46k views

Upload Multiple Files With media_handle_upload

I have a WordPress form plugin and I use media_handle_upload to upload the files and get there ids directly and attached its ids to the post as a meta date, I used the following to did that: The HTML ...
Engr.MTH's user avatar
  • 263
14 votes
1 answer
18k views

simple solution for restricting access to (some) uploads/downloads

Initial Situation For a site I'm setting up I was looking into the whole field of securing uploads/downloads and restricting access to them based on user roles/capabilities. Of course I have read ...
Nicolai Grossherr's user avatar
14 votes
4 answers
8k views

Load minimum WordPress environment

I made my own upload service for my website that is separate from WP, but uses WP to provide low level db functions and user verification. To do that, I include wp-load.php in my main script (...
MechEngineer's user avatar
14 votes
8 answers
14k views

Get $image_id after uploading with media_sideload_image()

I want to upload an image and set it as a featured image in a post. What i tried was this: $image_id = media_sideload_image($image_url, $post_id, $post_id); update_post_meta($post_id, '_thumbnail_id',...
Xavin's user avatar
  • 141
11 votes
4 answers
10k views

How to add a custom field to the media screen (image/gallery)?

I’m trying to add a custom field to image and gallery edit screen. I’m aware there are similar questions here, although answers either don’t work with the current version or they add field only to ...
Runnick's user avatar
  • 1,009
8 votes
1 answer
2k views

WordPress 3.5: Switch back to Old Media Uploader?

Is there any way to switch back to the old media uploader in WordPress 3.5? The new one is very slow for me, as I have thousands and thousands of images across my site, and I have a few plugins that ...
Sal's user avatar
  • 93
6 votes
1 answer
9k views

Different upload directory based on post type in a theme

I have a lot of uploaded image files and image sizes. So it would be better to organize media files into folders based on post type. I have just read this tutorial, but as I can see it works with ...
Attila's user avatar
  • 361
6 votes
2 answers
2k views

Image upload callback in new 3.5 media

I am using new 3.5 media uploader in my theme frontend (base on this example). It is very simple when you want to do something with images after the 'Select' button is pressed: file_frame.on('select',...
fornyhucker's user avatar
6 votes
6 answers
18k views

Disable image attachment links

Is there a way to disable image attachment links trought a filter in functions.php or something ? I know it's possible to do it manually when you add an image to a post but I want to disable this ...
inwpitrust's user avatar
6 votes
2 answers
2k views

Is it possible to share WordPress media files among different domains?

I have multiple Wordpress instances that live on separate domains (not a multisite installation). Since they provide the same content in different languages I'd like to share the images among these ...
Lorenzo's user avatar
  • 287
5 votes
1 answer
4k views

media_sideload_image generates blank?

I'm creating a custom post form that is supposed to take an external image and uploads it to the media library and attach it to that post. This should be possible by using media_sideload_image, but I'...
FLX's user avatar
  • 1,007
4 votes
3 answers
8k views

Settings in 'Media > Settings' is ignored when inserting images

When I upload an image, it is automatically resized as I would expect, however the sizes for inserting the image seem to ignore the settings I've placed in Settings/Media. In my media settings I have:...
Gary's user avatar
  • 175
3 votes
1 answer
5k views

front end post with multiple upload images?

I am using front end post with upload image, my code if (!function_exists('wp_generate_attachment_metadata')){ require_once(ABSPATH . "wp-admin" . '/includes/image.php'); ...
Ehab Fawzy's user avatar
3 votes
2 answers
24k views

Create Image Uploader for Widget

I found this post// Use Media upload in custom widget on wordpress 3.5 I'm not experienced in any of this so I pretty much just copied the code he provided into my own functions.php file. I uploaded ...
keilowe's user avatar
  • 90
3 votes
4 answers
4k views

How to set custom upload directory per user after moving content directory

I set the content and the wordpress directory of wordpress like described in the codex: define('WP_SITEURL', 'https://' . $_SERVER['SERVER_NAME'] . '/wordpress'); define('WP_CONTENT_DIR', dirname(...
mcnesium's user avatar
  • 247
0 votes
2 answers
2k views

How to share /uploads/ directory with another site on the same server?

both main and second domain (addon domain ) are in same host i want to find a way to change upload directory to another directory that located in another domain root. default location (first location)...
Positive Mind's user avatar
33 votes
3 answers
10k views

Plupload Intergration in a meta-box?

I know that plupload is going to be the new upload engine for WordPress 3.3 but I was wondering if there is any documentation yet on how it integrates with WordPress. My specifically how to collect ...
Manny Fleurmond's user avatar
22 votes
3 answers
7k views

How to add new tab to media upload manager with custom set of images?

I would like to add new tab to upload manager and inside list images from theme_folder/images/patterns I tried something like this to add a tab but it does not work for me since it is adding tabs ...
Benn's user avatar
  • 1,043
18 votes
6 answers
23k views

Add a Meta Box for uploading a SECOND Featured Image?

I'd like to add a meta box to my posts and page editor that will allow me to upload an image and use it as sort of a SECOND featured image. The idea is that my client will be able to upload an image ...
jkupczak's user avatar
  • 1,056
15 votes
2 answers
23k views

WordPress 3.5: Setting custom "full URL path to files" in the Media Library?

As the recent changes in WordPress 3.5 removed the "full URL path to files" option from media library I am wondering how to set this option to a custom path now? I need to set my "full URL path to ...
faxxim's user avatar
  • 185
12 votes
1 answer
1k views

Reject upload of wrong-sized images using the Media Uploader

I'm working on a super-strict setting for adding images to Custom Fields in the Post Edit screen. My optimal scenario would be to add a a Custom Error message when the user tries to upload an image of ...
moraleida's user avatar
  • 2,245
12 votes
1 answer
3k views

How to disable generation of default image sizes for some custom post types?

I used custom post type, where 'thumbnail', 'medium' and 'large' sized not required. I need to disable this sizes and create function or plugin, where i can set, which image size is required for each ...
Bohdan Hdal's user avatar
10 votes
3 answers
24k views

Allow all file types for upload

I'm using Wordpress 3.4.2 for a private blog, i.e. one on which only I can post. Now, Wordpress prevents me from uploading certain file types (like C# source files). As far as I understand it, there's ...
Sebastian Krysmanski's user avatar
10 votes
1 answer
8k views

how to upload and allow downloads of .mobi and .epub formats

I have downloadable products for sale. I have created custom meta boxes to hold the file data I need, it allows me to upload fine to the custom meta the .doc and the .pdf files... However when I ...
Michael Stott's user avatar
9 votes
5 answers
12k views

How to increase the file size limit for media uploads?

How can I change the Maximum upload file size? I would like to be able to upload 10Mb at a time.
jessegavin's user avatar
  • 3,456
9 votes
10 answers
61k views

Import Wordpress xml file larger than 8mb

I'm trying to import a xml file (from a previous wordpress theme) into a new wordpress theme. The problem is that the xml file is 46mb much bigger than the wordpress 8mb limit. Anyone have any advice/...
apagey's user avatar
  • 91

1
2 3 4 5