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);
};
<?
//------------------------------------------------------------
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));
}
?>
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”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.
Our community of experts have been thoroughly vetted for their expertise and industry experience.