Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
No 'tmp_name' being set when uploading utf-16 xml in a zip through php

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

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!