diff --git a/plugins/importFE/src/FatturaElettronica.php b/plugins/importFE/src/FatturaElettronica.php index 92ee22ead..1ca310368 100755 --- a/plugins/importFE/src/FatturaElettronica.php +++ b/plugins/importFE/src/FatturaElettronica.php @@ -179,7 +179,7 @@ class FatturaElettronica foreach ($allegati as $allegato) { $content = base64_decode($allegato['Attachment']); - $extension = ''; + $extension = '.pdf'; if (!empty($allegato['FormatoAttachment'])) { $extension = '.'.strtolower($allegato['FormatoAttachment']); } diff --git a/src/Models/Upload.php b/src/Models/Upload.php index 4c1214e2d..e5dd849a1 100755 --- a/src/Models/Upload.php +++ b/src/Models/Upload.php @@ -104,16 +104,17 @@ class Upload extends Model // Creazione del file fisico directory($directory); + $file = slashes($directory.DIRECTORY_SEPARATOR.$filename); if ( - (is_array($source) && is_uploaded_file($source['tmp_name']) && !move_uploaded_file($source['tmp_name'], $directory.'/'.$filename)) || - (is_string($source) && is_file($source) && !copy($source, $directory.'/'.$filename)) || - (is_string($source) && !is_file($source) && file_put_contents($directory.'/'.$filename, $source) === false) + (is_array($source) && is_uploaded_file($source['tmp_name']) && !move_uploaded_file($source['tmp_name'], $file)) || + (is_string($source) && is_file($source) && !copy($source, $file)) || + (is_string($source) && !is_file($source) && file_put_contents($file, $source) === false) ) { throw new UnexpectedValueException("Errore durante il salvataggio dell'allegato"); } // Aggiornamento dimensione fisica e responsabile del caricamento - $model->size = FileSystem::fileSize($directory.'/'.$filename); + $model->size = FileSystem::fileSize($file); $model->user()->associate(auth()->getUser()); // Rimozione estensione dal nome visibile