PHP从目录中插入文件

时间:2013-01-22 03:47:08

标签: php file insert

我在目录中通过FTP上传文件,现在我尝试将该文件保存到数据库并删除FTP目录中的文件...这是我的代码

$myimage = "C:\upload\satu.xml";;
$image = file_get_contents($myimage);
$content=addslashes($image);

$conn = oci_connect('ARTERI','password','192.168.1.1/Mutual');
$stid = oci_parse($conn, "INSERT INTO MMSHOSPITAL.HASIL_PEMERIKSAAN (ID, ID_REGISTRASSI, ID_UNIT_LAYANAN, CONTENT)".
                         "VALUES('1', '172', 'ACT', '".$content."') ");
oci_execute($stid);
oci_close($conn);

请帮助我......该代码无法将文件保存在我的数据库表中。

1 个答案:

答案 0 :(得分:1)

$myimage = "C:\upload\satu.xml";
$image = is_file($myimage);//this return true of false
$content=file_get_contents($myimage);//this reads the content of file as string