Re: Re: Subject: file upload into mySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am rewrite code again and success to upload into server. But  I do not think I can upload filer into mySQL.
I still can not get whether my SQL, marked on red, is correct or not.  I  would like to insert binary file into
b_col blob filed.
Please see my code:


    if (isset($_FILES['UploadedFile'])){
     
  $original_tmp = $_FILES['UploadedFile']['tmp_name'];
  $original_name = $_FILES['UploadedFile']['name'];
  $original_type = $_FILES['UploadedFile']['type'];
  $original_size = $_FILES['UploadedFile']['size'];


  //$uploaddir = '/home/www/jp.siligate.com/php/t/';
 // $original = $uploaddir. $_FILES['UploadedFile']['name'];
  $original = $_FILES['UploadedFile']['name'];
  move_uploaded_file($original_tmp, $original); 

  $sql_insert = "INSERT INTO objects VALUES ('$original','$original_name','$original_size','$original_type',now())";
  mysql_query($sql_insert);






Also I forget to write typt file in table:

create table objects {
          b_col blob,
          name varchar(30),
          file_size varchar(30),
          file_type varchar(30),
          file_date datetime
}



The result is that it shows blow;
--------------------------------------------------------------------------------
File Name :          File Size :          File Type :                      File Date :  

logo2.gif              1375                    image/gif                        2003-12-27 05:06:22 
ee.txt                     0                         application/octet-st        2003-12-27 04:59:04 
rer.pl                     0                         application/octet-st         2003-12-27 04:53:32 
tgt.java                 0                         application/octet-st          2003-12-27 04:49:05 
oko.cc                  0                         application/octet-st          2003-12-27 04:46:54 
xyz.pdf                  0                         application/octet-st          2003-12-27 04:42:43 


Can you help me your good advice.


Regards,
Hiro





 


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux