|  | Posted by Jensen Somers on 01/18/08 15:00 
cristina.lamberti@gmail.com wrote:> Ciao
 > tramite vari script in rete ho messo appunto un pezzettino di codice
 > che mi fa una sorta di download di un file dal database oracle.
 > Premessa: tabella TTM_ALLEGATI così composta:
 >
 > [CODE]
 >  SID_FILE   NUMBER(11)                         NOT NULL,
 >   NOME_FILE  VARCHAR2(255 BYTE)                 DEFAULT NULL,
 >   TIPO_FILE  VARCHAR2(128 BYTE)                 DEFAULT NULL,
 >   DATI_FILE  CLOB
 > [/CODE]
 >
 >
 > ..il mio codice ....
 >
 > [CODE]
 > $sql = "SELECT NOME_FILE,DATI_FILE,TIPO_FILE FROM TTM_ALLEGATI WHERE
 > SID_FILE =?";
 >
 > 		$row = $conn->getRow($sql, array($id), DB_FETCHMODE_ASSOC);
 > 		$conn->commit();
 > 		if($row)
 > 		{
 >
 > 			$obj = new TicketVO($row);
 > 			header('Cache-Control:');
 > 			header('Pragma:public');
 > 			header("Content-Type: application/octet-stream");
 > 			header("Content-Disposition: attachment; filename=" .
 > $row['NOME_FILE']);
 >
 > 			if (@fopen($row['NOME_FILE'],"x+")) {
 > 				echo $row['DATI_FILE'];
 > 				@fwrite($file_php,$row['DATI_FILE']);
 > 				@fclose($file_php);
 > 			}else{
 > 				echo $row['DATI_FILE'];
 > 				$file_php=@fopen($row['NOME_FILE'],"r+");
 >
 >
 >
 > 				@fwrite($file_php,$row['DATI_FILE']);
 > 				@fclose($file_php);
 > 			}
 >
 >
 > 		}
 > 		}
 > [/CODE]
 >
 > Praticamente recupero dal database il nome, il tipo e i dati del file
 > e tento una sorta di ricostruzione del file.
 >
 > Premetto che prima di questo ho sviluppato l'upload del file :)
 >
 > Finchè effettuo la sorta di download di un file txt funziona ma quando
 > vado a downloadare un file tipo doc mi va in errore.
 > Riporto l'errore di Office Word:
 > Word experienced an error trying to open the file.
 > Try these suggestions:
 > _Check the file permissions for the document or drive
 > _Make sure there is sufficient free memoru and disk space.
 > _Open the file with text Recovery converter.
 >
 > Cosa devo fare in merito????
 >
 > Grazie
 
 This is an international newsgroup so please use English.
 
 - Jensen
  Navigation: [Reply to this message] |