troubleshooting Question

Could you point why an Excell file read at browser (js) is obtained at PHP code as a tmp file?

Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil asked on
LaravelPHPJavaScript
15 Comments1 Solution108 ViewsLast Modified:
Hi Experts

Could you point why an Excell file read at browser (js) is obtained at PHP code as a tmp file?

Accordingly with:
img001
The JS code called (that produces the console showed above):

 
User.prototype.subirLote = function() {
 // Called to upload the file
   console.log('XXXX');
  $("#arquivoLote").trigger("click");
  
  arquivo = $("#arquivoLote").val();
  
// The name is empty
  console.log('Y ' + arquivo);

};

When this PHP code is called:
<? 
//------------------------------------------------------------
    public function subirLote(Request $request){
//------------------------------------------------------------  
      
      $arquivo=$request->file('arquivoLote');
	  
	  
*--- AT THIS POINT THE FILE IS RECEIVED AS: C:\xampp\tmp\php6669.tmp (OR SOMETHING LIKE)
file_put_contents('debug.log', 'Arquivo = '. $arquivo.PHP_EOL , FILE_APPEND);
*-----------------------------------------------------------------------------

      Config::set('excel.import.heading', 'slugged_with_count');
      Config::set('excel.import.startRow', 1);

      try{

        $arquivoUrl = AzureStorage::saveFile($arquivo,'arquivos');
    
        $planilha = Excel::selectSheets('Participantes')->load($arquivo)->toArray();
      
        $validacao = $this->validarArquivo($planilha);
        

        if(!$validacao["valido"])
		{  
   
          return response()->json(new Resultado(false,"",$validacao));
        }
        
        $this->processarLote($planilha);
    
        $saida = array (
          "mensagem"=>"<div class='alert alert-success text-center'><strong>Sucesso:</strong> Arquivo processado com sucesso!</div>",
          "valido"=>true
        );

      } catch (\Exception $e) {
        Debugbar::info($e);
        Log::error($e);
        

        $saida = array (
          "mensagem"=>"<div class='alert alert-warning text-center'><strong>Informação:</strong> 002 Arquivo de participantes com formato inválido.<br />Por favor, verifique-o antes de continuar</div>",
          "valido"=>false
        );
      }
      return response()->json(new Resultado(false,"",$saida));
    }
 ?>

img002
The code is under Laravel with Excel Libraries, I don't know if this error is related with this fact.

Thanks in advance
ASKER CERTIFIED SOLUTION
Eduardo Fuerte
Developer and Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros