PHP - GUARDAR ARCHIVO EN RUTA ESPECIFICA

 
Vista:
sin imagen de perfil

GUARDAR ARCHIVO EN RUTA ESPECIFICA

Publicado por Alberto (6 intervenciones) el 19/01/2017 15:02:04
GENERO UN PDF PERO NO SE ESPECIFICAR LA RUTA DE GUARDADO AL GENERARLO

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**** GENERA EL PDF CON LAS ETIQUETAS ****/
function descargarEtiqueta($albaran){
 
	$ruta = TRANSPORTE_UPLOADS.$albaran.'.pdf';
        $pdf = TRANSPORTE_UPLOADS_URL.$numAlbaran.'.pdf';
        $numAlbaran = $respuesta['v1:strAlbaranOut'];
 
	if (!file_exists($ruta)){
		$xml = '<?xml version="1.0" encoding="utf-8"?>
			<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
				<soap:Header>
					<ROClientIDHeader xmlns="http://tempuri.org/">
						<ID>'.$_SESSION['transporte']['idSesion'].'</ID>
					</ROClientIDHeader>
				</soap:Header>
				<soap:Body>
					<WebServService___ConsEtiqueta>
						<strCodAgeOri>'.$this->agencia.'</strCodAgeOri>
						<strAlbaran>'.$albaran.'</strAlbaran>
						<intIdRepDet>0</intIdRepDet>
						<strFormato>'.$pdf.'</strFormato>
					</WebServService___ConsEtiqueta>
				</soap:Body>
			</soap:Envelope>';
 
 
		$respuesta = transportePost($xml, $this->url);
 
		if (isset($respuesta['v1:strEtiqueta']) && strlen($respuesta['v1:strEtiqueta'])>10){
			$pdf = base64_decode($respuesta['v1:strEtiqueta']);
			file_put_contents($ruta, $pdf);
		}else $this->printMessage('La etiqueta no está disponible', 0);
	}
}


Necesito que $ruta es decir TRANSPORTE_UPLOADS.$albaran.'.pdf' se guarde en una carpeta en concreto
¿ COMO LO HAGO ?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Developer

GUARDAR ARCHIVO EN RUTA ESPECIFICA

Publicado por Developer (52 intervenciones) el 23/01/2017 19:10:00
Hola amigo, nada menos ahi debes de especificar tu ruta... en la variable $ruta ...
Es algo reduntante tu pregunta.

Para poder acceder a la ruta, debes de usar rutas relativas y no absolutas.

Saludos!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar