$max_size) { header("HTTP/1.1 400 " . $name . " file too large"); exit(); } if (! extension_loaded('mbstring')) { header("HTTP/1.1 500 php module missing"); exit(); } if(! mb_check_encoding($name)) { header("HTTP/1.1 400 Bad encode"); exit(); } $target_file = $target_dir.$name; // Check if file already exists if (file_exists($target_file)) { header("HTTP/1.1 400 This file already exists"); echo "This file already exists."; } else { if(file_put_contents($target_file, fopen($url, 'r'))) { echo "The File ".$name." of size ".formatBytes($size)." has been uploaded."; } else { header("HTTP/1.1 500"); echo "There was an error uploading your file."; } } ?>