Hi,
ok, first of all make sure your form tag is like :
<form method="POST" name="ImageForm" action="UploadImage.php3" 
ENCTYPE="multipart/form-data">

The ENCTYPE is important!

Next, make sure you have a field like:
<input type="file" size="50" name="txtImage">
type="file" is important!  This will present a browse button for the user to browse 
their drives


something like this seems to work - drop the addslashes if it is not a binary file, 
such as an image
------------------------
$filecontents = addslashes(fread(fopen($txtImage, "r"), filesize($txtImage)));
$thisfiletype = $txtImage_type;
 $db = mysql_select_db("somedb", $someconnection) or die ("db");
 $sql = "INSERT INTO Images (..all the fields...) VALUES ('$filecontents',...and all 
the rest of the fields')";

 $sql_result = mysql_query($sql,$someconnection) or die ("could not insert into DB");
  mysql_close($someconnection);

----------------------------------------------------------

Hope this helps..

Phil J.








Zeus wrote:

> I'm trying to do a filexchange script.
>
> Does anyone know how to upload a file into the database such that when I do a 
>'select *' query, I can click on a link the download that file.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to