diff --git a/ci4/app/Services/ImpresoraEtiquetaService.php b/ci4/app/Services/ImpresoraEtiquetaService.php index 63f8ae9a..3e5d3408 100644 --- a/ci4/app/Services/ImpresoraEtiquetaService.php +++ b/ci4/app/Services/ImpresoraEtiquetaService.php @@ -78,6 +78,12 @@ class ImpresoraEtiquetaService extends BaseService } protected function sendToImpresoraEtiqueta(string $name, string $content, ImpresoraEtiquetaEntity $impresoraEtiqueta): bool { + $tmpFile = tmpfile(); + + fwrite($tmpFile, $content); + rewind($tmpFile); + + $tmpMetaData = stream_get_meta_data($tmpFile); $conn = @ftp_connect($impresoraEtiqueta->ip,$impresoraEtiqueta->port); if(!$conn){ throw new Exception('Error al establecer conexión FTP'); @@ -90,7 +96,7 @@ class ImpresoraEtiquetaService extends BaseService if (!ftp_pasv($conn, true)) { throw new Exception('Error entrando en modo pasivo'); } - if (ftp_put($conn, $name, $content, FTP_ASCII) === FALSE) { + if (ftp_put($conn, $name, $tmpMetaData['uri'], FTP_ASCII) === FALSE) { $status = false; ftp_close($conn); }else{