http://bentasker.i2p/posts/documentation/development-programming/175-allowing-file-uploads-direct-from-dropbox.html
$fname;
$fh = fopen ($tmpfile['tmp_name'],'w');
fwrite($fh,$data);
fclose($fh); // Return the data necessary for the final bit of the script to do it's job
return $tmpfile;
} // For our purposes Dropbox files take priority.
// There's no reason you can't allow both, though!
if ($_POST['dropbox-selected-file']){
$file = retrieve_dropbox_file();
}else{
$file = $_FILES['oldstyleupload'];
}...