I'm relatively new to PHP and I'm creating an upload page for database reports. These reports automatically come as utf-16 XML pages and can't be converted to utf-8 on creation. The report comes with a summary page and the report page, which are then archived and submitted. The only issue is that every file uploads - apart from utf-16 encoded files in a zip. The zip files don't seem to be getting set a tmp_name, but they do if the files are utf-8 or any other file.
My code is as follows:
$newfiles = array_filter($_FILES['userfile']['name']);
$count= count($_FILES['userfile']['tmp_name']);
echo $count
for($i=0; $i<$count; $i++) {
//Setup a temp filepath
$tmpFilePath = $_FILES['userfile']['tmp_name'][$i];
echo 'temp file path is set as ' . $tmpFilePath;
//Make sure we have a filepath
if ($tmpFilePath != ""){
//Setup our new file path
$destination_path = getcwd().'/ddr/';
$target_path = $destination_path . basename( $_FILES['userfile']. ['name'][$i]);
//echo "hello";
if (move_uploaded_file($tmpFilePath, $target_path)) {
echo "The file ". basename( $_FILES["userfile"]["name"] [$i]). " has been uploaded to " . $target_path;
} else {
echo "Sorry, there was an error uploading your file to " . $target_path;
}
$uploadfiletype = pathinfo($target_file,PATHINFO_EXTENSION);
if ($uploadfiletype = '.zip'){
$zip = new ZipArchive;
$res = $zip->open($target_path);
if ($res === TRUE) {
$zip->extractTo($destination_path);
$zip->close();
//echo 'ok';
} else {
echo 'failed';
}
}
}
}
My echo 'temp file path is set as ' . $tmpFilePath; just returns with out a $tmpfilepath value but echo $count; does return a value. Any ideas?
Thanks in advance
Edit: It's nothing to do with max upload size