Single file upload
You can just grab the first file in the $_FILES array. if ($_FILES) { return $FILES[0]; }
You can just grab the first file in the $_FILES array. if ($_FILES) { return $FILES[0]; }
Bizarrly, the answer to this is to simply swap two of the parameters around – tb_show(‘Manage Front Page Images’, ‘media-upload.php?referer=dd-options&post_id=65&TB_iframe=true’, false);
In WordPress we can change the default location of the wp-content folder by defining a couple constants in wp-config.php about it here on Codex So if the structure on the server looks like this: /root/ 1. myblog.tld – its own directory 2. sub.myblog.tld – its own directory You can use this in your wp-config.php: define( … Read more
Assuming that you are using the WordPress native Media uploader then you can use the upload_mimes filter hook to add or remove allowed file types, for example: function custom_myme_types($mime_types){ //Adding avi extension $mime_types[‘avi’] = ‘video/avi’; //Removing the pdf extension unset($mime_types[‘pdf’]); return $mime_types; } add_filter(‘upload_mimes’, ‘custom_myme_types’, 1, 1); You can see that to add a file … Read more
It turned out to be an .htaccess rule put in by a coworker. It was supposed to target just some .pdf files but the rule wasn’t written strict enough. So that was a fun few hours spent on wild goose chases.
If you look at media_handle_sideload in source, you can see how it works. The function that generates the various sizes is within wp_generate_attachment_metadata, the image_make_intermediate_size function. You could possibly use the wp_handle_sideload function instead and manually resize it via image_make_intermediate_size.
Well’ for anyone that faces this problem. look here: plesk-permissions-wordpress
Please try to upload the php.ini file to the document root directory or to the same directory as wp-config.php. You may also want to modify memory_limit to 120M and modify max_execution_time to 300.
Virtually all the core files and scripts that WordPress uses for displaying the media library are within the wp-admin folder, plus it uses various admin-only hooks, so using this on the front-end is pretty much out of the question. It’s not difficult to allow users to upload to the media library from the front end … Read more
Is there a way to force Featured image to show as attachement?