Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

186
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda