This commit is contained in:
amazuecos
2025-04-02 14:00:10 +02:00
parent 492c7366cf
commit 9924f27b5b

View File

@ -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{