Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda