wp_upload_bits

WordPress has a bunch of great uploading functions for everything from checking the file type to finding the uploads directory. A more obscure function is wp_upload_bits(), which you can use to upload a file to the uploads directory.

[php]
$upload = wp_upload_bits( $_FILES[‘myfile’][‘name’], null, file_get_contents( $_FILES[‘myfile’][‘tmp_name’] ) );
echo ‘Well uploaded! The path to this file is ‘ . $upload[‘file’] . ‘ and the url to this file is ‘ . $upload[‘url’];
[/php]