|
|
|
make upload and download inwabsite by php+oracle? i make website by php to connect DB oracle |
|
|
|
|
|
|
|
Go to : PHP Oracle : Connect to Oracle Database ภาษา PHP กับฐานข้อมูล Oracle
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
if($_FILES["filUpload"]["name"] != "")
{
//*** Insert Record ***//
$objConnect = oci_connect("myuser","mypassword","TCDB");
$lob = oci_new_descriptor($objConnect, OCI_D_LOB);
$strSQL = "INSERT INTO FILES ";
$strSQL .="(FILESID,NAME,FILESTYPE,FILESNAME) VALUES ";
$strSQL .="(seq_next_filesid.nextval,'".$_POST["txtName"]."' ";
$strSQL .=",'".$_FILES["filUpload"]["type"]."',EMPTY_BLOB()) RETURNING FILESNAME INTO :BLOBDATA";
$objParse = oci_parse($objConnect, $strSQL);
oci_bind_by_name($objParse, ':BLOBDATA', $lob, -1, OCI_B_BLOB);
$objExecute = oci_execute($objParse, OCI_DEFAULT);
$lob->savefile($_FILES['filUpload']['tmp_name']);
if($objExecute)
{
oci_commit($objConnect);
echo "Copy/Upload Complete<br>";
}
else
{
oci_rollback($objConnect);
echo "Copy/Upload is not Complete";
}
oci_free_descriptor($lob);
oci_free_statement($objParse);
oci_close($objConnect);
}
?>
<a href="PageUploadToOracle3.php">View files</a>
</body>
</html>
Go to : PHP Upload Oracle BLOB (Binary Data)
|
|
|
|
|
Date :
2011-07-06 16:35:45 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|