Hi everyone thanks.
I did add the enctype but it's still not working. Here're
 the codes
Sorry if I posted to the wrong list. because I was trying to store the file as well in 
the mysql db blob. Someone suggested to print all the $ post vars as I print, only the 
MAX_FILE_SIZE shows up as a variable. I also tried directy assigning $userfile = "C: 
blabla" and it gives the same thing
One more thing do I have to use base_64 encode for this ? 

<FORM ACTION="upload.php" METHOD=POST  enctype="multipart/form-data" name="upload" 
  <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="65000">
  Send this file: 
  <input type="file" name="userfile">
  <INPUT TYPE="submit" VALUE="Upload file">



   echo $_POST['userfile']['tmp'];  // never got echoed it seems to be empty.

   if (is_uploaded_file($userfile)) 
        copy($userfile, $HTTP_POST_FILES['userfile']['name']);
   else  echo "error. File: $userfile."; // this is invoked  but it can't print 
$userfile either. 


   $fd = fopen ($filename, "rb");

   $contents = fread ($fd, filesize($filename));


              // Connecting, selecting database

   $link = mysql_connect("localhost", "**","**");
   // Performing SQL query; assuming that the "picture" is a    BLOB field
   $query = "UPDATE studentpart SET pic='$escaped_contents'     WHERE 
   $result = mysql_query($query)
   or die("Query failed");
   // Closing connection

errors example filename tried to upload is c:\\windows\Backgrnd.gif

error. File: .
Warning: fopen(Backgrnd.gif) [function.fopen]: failed to create stream: No such file 
or directory in /home/bus8646/www/tryout/upload.php on line 9

Warning: filesize() [function.filesize]: Stat failed for Backgrnd.gif (errno=2 - No 
such file or directory) in /home/bus8646/www/tryout/upload.php on line 10

Warning: fread(): supplied argument is not a valid stream resource in 
/home/bus8646/www/tryout/upload.php on line 10

Warning: fclose(): supplied argument is not a valid stream resource in 
/home/bus8646/www/tryout/upload.php on line 11
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in 
/home/bus8646/www/tryout/upload.php on line 15

Query failed

Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to