Articles of uploads

wp_generate_attachment_metadata for non-images files

I created a frontend form for upload images and worked fine. The only problem is that I need generate attachment metadata for non images file. Now, metadata is only created for images files. I’m using these lines for generate and insert metadata: $attachment_data = wp_generate_attachment_metadata( $attachment_id, $filename ); wp_update_attachment_metadata( $attachment_id, $attachment_data ); SOLVED I made […]

Allow user to Upload image and manipulate it on the frontend

The site I am working on allows users to post things up for sale. In the form for creating their post, there is a simple file upload field. The problem is that sometimes when users upload images they end up rotated and they have no way of choosing. I have put together a php script […]

Programmatically Upload File to WordPress Using an API

I believe there is a WordPress API that can be used to programmatically upload a local file from a Windows Documents Folder using any application (like C#) to upload a file to the WordPress uploads folder. Can anybody give me an example or explain a better route to take?

Uploading new version of theme fails, folder already exists

I developed a theme for my site. When I make changes, I simply change the version number from 1.0 to 1.2, etc. I zip the files inside a folder called tamaltheme and upload using the theme uploader. This message pops up: Unpacking the package… Installing the theme… Destination folder already exists. …public/wp-content/themes/tamaltheme/ When I don’t […]

Get audio metadata on file upload

I am trying to fetch all audio metadata when I upload a file. This all happens in a plugin, and I currently use the add_attachment action to trigger my custom function : // link add_action( ‘add_attachment’, ‘add_metadata’ ); // Definition public function get_metadata( $post_ID ) { $post = get_post( $post_ID ); var_dump( $post ); var_dump( […]

Cleaning a filename after image sideloading a url that contains `%20`

Right now I’m creating a plugin to sideload images from an external source. The UI allows me to select files on the external server then downloads them via AJAX & media_sideload_image. Everything is working great. After the images is loaded I clean up the attachment’s title by replacing the dashes and underscores with spaces in […]

Get URL of Featured Image After wp_insert_post()

I want to get the url of a featured image. I’ve created a function with wp_insert_post to post data and set a featured image for them. Everything works fine except displaying the url of featured image. Here is my code : $newpostname = $movie[‘title’]; global $wpdb; $id_ofpost_name = $wpdb->get_var( “SELECT ID FROM $wpdb->posts WHERE post_name […]

WordPress HTTP Error on File upload

I have increased the max_file_upload_size from 20 MB to 100 MB in WordPress, but I’ve been facing a problem since then. Whenever I try to upload a file of any type, it says “HTTP Error” when I use the multiple file uploader. I’ve tried to upload using the single file uploader. It says “Error saving […]

Upload and attach to a post multiple image files

In a front end form I have a ‘multiple’ input field for uploading and attaching images to a post and a processing script (from here). I expect that will be uploaded and attached all files that I have selected, but this doesn’t happens. Is uploaded and attached only the last selected file (in alphabetical order). […]

limit media upload to once a day

Is there a way (with hook or plugin) to limit media upload to once a day per user? I can only find related articles about limit file size. Edit: The reason I want to use this is I’m setting up a social site where people share images. I’m seeing an increase in data usage and […]