Metabox with multiple fields added by user and upload box

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

Hook or function to upload media via url

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)