Can’t upload media, permissions are correct
I found the problem. In settings > media the folder for uploads was actually pointing to a different path. Once I redirected it to wp-content/uploads it all worked.
I found the problem. In settings > media the folder for uploads was actually pointing to a different path. Once I redirected it to wp-content/uploads it all worked.
In a previous tinymce plugin I made – I set up a custom ajax transport so I could just use the blob right from the image src of a remote img instead of base64 on a data attribute, and then used the REST API to upload the image to the media library in js. Base64 … Read more
This is not possible via the API; you need to fetch the image yourself, and send the data to the API yourself. Blockquote – This quotes Ryan on the GitHub–issue mentioned in @Dan (deleted) answer. How to side load images Note that the media_sideload_image() return value can be an instance of \WP_Error as well. You … Read more
I ended up solving it by completely bypassing the wp upload system, so this is how it looks now: /* * Define new upload paths */ $uploadfolder = WP_CONTENT_DIR . ‘/exames’; // Determine the server path to upload files $uploadurl = content_url() . ‘/exames/’; // Determine the absolute url to upload files define(RM_UPLOADDIR, $uploadfolder); define(RM_UPLOADURL, … Read more
Here is the working code (working fine for me), did you tried this? Just add to theme ‘functions.php’ and change the custom field names as needed. //function to add custom media field function custom_media_add_media_custom_field( $form_fields, $post ) { $field_value = get_post_meta( $post->ID, ‘custom_media_style’, true ); $form_fields[‘custom_media_style’] = array( ‘value’ => $field_value ? $field_value : ”, … Read more
Attachments in general (images, but also files like PDFs) have a special “attachment page” of the form example.com/main-post/attachment/file-title/. In most themes this is used to display a larger version of the image, still in the theme layout (so it returns a HTML file with the image in it, not the image directly). You could exploit … Read more
Short Answer example.com/bob/files/picture.jpg is the preferred, canonical URL for images in a WordPress Multisite installation. The two URLs with blogs.dir in the URL are essentially identical, and both leverage the filesystem structure. The path with ‘bob’ exists because you did a sub-directory install, not a subdomain install. Other paths would exist based on your other … Read more
Here’s a complete example for how we do it in Easy Digital Downloads: /** * Set Upload Directory * * Sets the upload dir to edd. This function is called from * edd_change_downloads_upload_dir() * * @since 1.0 * @return array Upload directory information */ function edd_set_upload_dir( $upload ) { $upload[‘subdir’] = ‘/edd’ . $upload[‘subdir’]; $upload[‘path’] … Read more
It sounds like you need to change the URLs for the old images. The easiest & quickest way of doing that is to do a find and replace on the MySQL database. You can use PHPMyAdmin (usually provided by your web host) or other MySQL editing software such as Sequel Pro to make changes to … Read more
Assuming that you’re providing upload functionality via WordPress’ native functions, lik wp_handle_upload or something more high-level, we come to the conclusion that several hooks are going to be pulled. http://core.trac.wordpress.org/browser/tags/3.3/wp-admin/includes/file.php#L212 The wp_handle_upload function would probably be the last native function to touch the file, and would know all the information that is necessary to keep … Read more