Metabox image upload and custom field
I think this should help: http://austinpassy.com/2010/03/creating-custom-metaboxes-and-the-built-in-uploader/
I think this should help: http://austinpassy.com/2010/03/creating-custom-metaboxes-and-the-built-in-uploader/
Markup of that metabox is generated by _wp_post_thumbnail_html() function, contained in wp-admin/includes/post.php.
yes, this: https?://yoursite.com doesn’t do anything you want, just make it http://yoursite.com. Next to that, make sure your server actually supports RedirectMatch.
I’ve used this to add webm support to the wordpress 3.3.1 uploader. add_filter(‘upload_mimes’, array(&$this, ‘addUploadMimes’), 1, 1); public function addUploadMimes($mimes){ $mimes = array_merge($mimes, array( ‘webm’ => ‘video/webm’ )); return $mimes; } I had to make it run with a high priority to stick.
I had the same problem, but some extra and different plugins, after 2 days of disabling plugins one by one, checking theme files etc, etc, I decide to start from 0, Backup database, (all post, etc,~) and just re install. Not a beauty, but it will solve the problem faster than you searching for the … Read more
The Custom Upload Dir plugin can help with this. For a teaser, they’ve got a screenshot of someone defining an upload behaviour which is similar to the one you’re asking for:
Here is how I’ve done it. No changes to the save function are needed. I’ve been trying to save data from both fields at once, thats why it didn’t worked. <input class=”upload_file” type=”text” size=”45″ id=”picture_%1$s” name=”picture_%1$s” value=”%6$s” /> <input class=”upload_button button” type=”button” value=”Upload File” /> <input class=”upload_file_id” type=”hidden” id=”picture_%1$s_id” name=”items[%1$s][picture]” value=”%7$s” /> The value stored … Read more
Check into the functions: wp_handle_upload() and media_handle_upload()
See media_handle_sideload in Codex: $url = “http://s.wordpress.org/style/images/wp3-logo.png”; $tmp = download_url( $url ); $post_id = 1; $desc = “The WordPress Logo”; // Set variables for storage // fix file filename for query strings preg_match(‘/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/’, $file, $matches); $file_array[‘name’] = basename($matches[0]); $file_array[‘tmp_name’] = $tmp; // If error storing temporarily, unlink if ( is_wp_error( $tmp ) ) { @unlink($file_array[‘tmp_name’]); … Read more
Check the documentation wp_handle_upload You need to include the file.php before calling wp_handle_upload require_once( ABSPATH . ‘wp-admin/includes/file.php’ )