0

I have upload file via FTP in a directory, Now i am try to save that file into database and delete file in FTP Directory... Here is my code

$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);

Help me please... that code is not work to save file in the table of my database..

3
  • 2
    y are u saving file only save path to file. Commented Jan 22, 2013 at 3:48
  • no, i need save file not just the path.. Commented Jan 22, 2013 at 3:50
  • How is CONTENT defined? Is it LOB? Commented Jan 22, 2013 at 4:03

1 Answer 1

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 
Sign up to request clarification or add additional context in comments.

8 Comments

this script i have try but invalid value, content column is blob in my table of oracle database
should i change into another type?
blob is ok it stores as binary . no problem
just select the content and display using correct content type .it will work
STIL ERRORRRORA-01465: invalid hex number in C:\xampp\htdocs\MMSBank\file\upload.php on line 25
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.