"; //if you want to log the entire contents of the POST and FILES arrays - uncomment these //log2file($_POST); //log2file($_FILES); if (isset($_POST['name'])){ print "got the name - ".$_POST['name']."
"; log2file("got the name - ".$_POST['name']); //if there is a temporary file if (isset($_FILES['photo']['tmp_name'])) { //grab the original file name $name = $_FILES['photo']['name']; //get the name of the temp file we uploaded it to $tmp_name = $_FILES['photo']['tmp_name']; log2file("Received file - $name, tmp name = $tmp_name
"); print("Received file - $name, tmp name = $tmp_name
"); $newpath = $path; $temp = explode(".", $name); $extension = strtolower($temp[1]); $newfile = $path.$name; print "newfile = $newfile
"; //url of where we'll be saving it $url = 'http://uberthings.com/mobile/tmp/'.$name; //this is all for directory creation - remove if you don't need it if (is_dir($newpath)) { log2file("$newpath exists"); } else { if (mkdir($newpath, 0775)) { log2file("$newpath directory created"); } else { log2file("$newpath dir creation failed"); } } if (move_uploaded_file($tmp_name, $newfile)) { log2file("File was uploaded to $newfile"); print('| File was uploaded to '.$newfile.' - '.$url.'
'); } else { log2file("File does not exist or there was an error"); print("| File does not exist or there was an error"); } } } else { //the following section will be shown if you just go to the URL with a normal web browser ?>
Send this file: