Created
November 9, 2018 03:55
-
-
Save brucenorton/a45c482315e90554cd5515449d7c08ae to your computer and use it in GitHub Desktop.
file uploader 2018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//upload.php | |
// *** chmod of 'uploads' folder to 777 *** | |
//create an array for the results | |
$responseArray = [ "file" => "upload.php" ]; | |
if (isset($_FILES['upload_file'])) { | |
if(move_uploaded_file($_FILES['upload_file']['tmp_name'], "../deleteMe/" . $_FILES['upload_file']['name'])){ | |
//echo $_FILES['upload_file']['name']. " OK"; | |
$responseArray["response"] = "success"; | |
$responseArray["file"] = $_FILES['upload_file']['name']; | |
} else { | |
//echo $_FILES['upload_file']['name']. " KO"; | |
$responseArray["response"] = "fail"; | |
} | |
echo(json_encode($responseArray)); | |
exit; | |
} else { | |
$responseArray["response"] = "fail"; | |
echo(json_encode($responseArray)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment