i'm following this tutorial: http://net.tutsplus.com/tutorials/javascript-ajax/uploading-files-with-ajax/comment-page-1/#comments to learn how to upload multiple files via ajax.
This is my html:
<form class="form-horizontal" id="settingsChangeAvatar" method="post" enctype="multipart/form-data" action="<?php echo $AJAX."/ajaxUpload.php"?>">
<input class="input-xlarge input-file" id="settingsUploadAvatar" name="settingsUploadAvatar" type="file" multiple />
<button class="btn" id="uploadAvatarButton" type="submit">Upload</button>
</form>
And this is my ajaxUpload.php:
foreach($_FILES["settingsUploadAvatar"]["error"] as $key => $error){
if($error == UPLOAD_ERR_OK) {
$name = $_FILES["settingsUploadAvatar"]["name"][$key];
move_uploaded_file($_FILES["settingsUploadAvatar"]["tmp_name"][$key], $_SERVER["DOCUMENT_ROOT"]."/webname/".$_FILES["settingsUploadAvatar"]["name"][$key]);
}
}
echo("File uploaded");
My code should be the same as the one in the tutorial. Thanks for helping.
var_dump($_FILES)to see what's in there? Basic debugging is in order here...[]on the end of the input's name attr:name='settingsUploadAvatar[]