Hi,
I am reading in a bunch of files to upload but they are in an array:
<input id="tab1file0" class="tab1Files files" type="file" name="tab1file[]" />
<input id="tab1file1" class="tab1Files files" type="file" name="tab1file[]" />
To upload the files I call a function uploadFile() which looks like this:
function uploadFile($thefile) {
$base_path = "files/";
$target_path = $base_path . basename( $_FILES[$thefile]['name']);
echo($_FILES[$thefile]['tmp_name']);
if(move_uploaded_file($_FILES[$thefile]['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES[$thefile]['name'])." has been uploaded <br>";
} else{
echo "There was an error uploading the file".basename( $_FILES[$thefile]['name']).", please try again!<br>";
}
}
The only problem is when I get the files from the form, they are in an array and I can't seem to point the correct string to the upload file function.
Thanks!