Measure and limit file uploads

I would use a multi site installation for this. Give each user their own blog. Multi Site has built in disk quota functionality, and you can see how much of it is used and such in the admin area of each site. You can set the quota in the network admin: settings > network settings. … Read more

Use wp_upload_dir() correctly

It seems that you’re either calling wp_upload_dir too early, when it has not yet been included in the scope (which is nearly impossible), or calling it without WordPress being even loaded (highly probable). If you’re using some sort of iframe to provide uploadify.php directly then WordPress will not be available for it. Include wp-load.php to … Read more

uploaded images not going to /uploads folder

If I remember it right, this happened to me once. I deleted my /uploads directory (to delete all the images) and went back to posting thinking that WordPress will automatically create an /uploads directory and any necessary sub-directories for me. And yes, that’s how it works. But here’s the catch — WordPress doesn’t set proper … Read more

Uploading PDF files from the front-end

I have done a simple function for that, but i allow all types of media. So this could be a start: function insert_attachment( $file_handler, $post_id, $settpdf=”false” ) { // check to make sure its a successful upload if ( $_FILES[$file_handler][‘error’] !== UPLOAD_ERR_OK ) __return_false(); require_once( ABSPATH . ‘wp-admin’ . ‘/includes/image.php’ ); require_once( ABSPATH . ‘wp-admin’ … Read more

Change the look of the media uploader

As starting point there is this action that allows inserting CSS and Javascript into the upload window. add_action( ‘admin_head-media-upload-popup’, ‘wpse_70750_style_upload_iframe’ ); function wpse_70750_style_upload_iframe() { ?> <style type=”text/css”> #media-upload, #media-upload .media-item .slidetoggle { background-color:#555 } </style> <script type=”text/javascript”> jQuery(document).ready( function($) { }); </script> <?php } Other Q&A’s that use this hook may be interesting. Then, you … Read more