mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
tmp file
This commit is contained in:
@ -78,6 +78,12 @@ class ImpresoraEtiquetaService extends BaseService
|
|||||||
}
|
}
|
||||||
protected function sendToImpresoraEtiqueta(string $name, string $content, ImpresoraEtiquetaEntity $impresoraEtiqueta): bool
|
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);
|
$conn = @ftp_connect($impresoraEtiqueta->ip,$impresoraEtiqueta->port);
|
||||||
if(!$conn){
|
if(!$conn){
|
||||||
throw new Exception('Error al establecer conexión FTP');
|
throw new Exception('Error al establecer conexión FTP');
|
||||||
@ -90,7 +96,7 @@ class ImpresoraEtiquetaService extends BaseService
|
|||||||
if (!ftp_pasv($conn, true)) {
|
if (!ftp_pasv($conn, true)) {
|
||||||
throw new Exception('Error entrando en modo pasivo');
|
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;
|
$status = false;
|
||||||
ftp_close($conn);
|
ftp_close($conn);
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user