From 9924f27b5bff724eeba53a5974d9a0de17657b56 Mon Sep 17 00:00:00 2001 From: amazuecos Date: Wed, 2 Apr 2025 14:00:10 +0200 Subject: [PATCH] tmp file --- ci4/app/Services/ImpresoraEtiquetaService.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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{