Created
February 12, 2014 06:49
-
-
Save paingpyi/8951045 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
$target_path = "uploads/"; | |
$uploadedFiles = array(); | |
/*** check if a file has been submitted ***/ | |
if(isset($_FILES['userfile']['tmp_name'])) | |
{ | |
/** loop through the array of files ***/ | |
for($i=0; $i < count($_FILES['userfile']['tmp_name']);$i++) | |
{ | |
// copy the file to the specified dir | |
if(@copy($_FILES['userfile']['tmp_name'][$i],$upload_dir.'/'.$_FILES['userfile']['name'][$i])) | |
{ | |
$messages[] = $_FILES['userfile']['name'][$i].' uploaded'; | |
} | |
else | |
{ | |
/*** an error message ***/ | |
$messages[] = 'Uploading '.$_FILES['userfile']['name'][$i].' Failed'; | |
} | |
} | |
} | |
header("Content-type:text/json"); | |
$json = json_encode(array("message"=>"ok")); | |
echo $json; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment