Copy link to clipboard
Copied
Hi I am having problems uploading a image file to a phpmyadmin database.
I have always uploaded text to database. Now I am trying to use the file browse option in dreamweaver.
At set up I am using:
$image=$_FILE['image']['name'];
$temp=$_FILE['image']['temp'];
move_uploaded_file($temp,'/images',$image);
//I also included the image variable in a inset function.
$upload=mysql_query(INSERT INTO images Values (' ','$image '));
I keep getting the default echo. Which says please fill in al fields. I believe I am not correctly uploading the image file. Could some one help me refine my code.
Thanks.
Copy link to clipboard
Copied
I don't think you want to upload files to the database, just the server locations of the files. The files would normally be uploaded to a location on the server using PHP (or some equivalent server-side language). The file browse feature provides an interface for locating a local file for upload, and the upload occurs via a php file processing that field of the form. You may want to search Google for "PHP file upload tutorial". YOu will probably find one that includes the html form field end of things as well.
Copy link to clipboard
Copied
I have checked alot online website for help I even watched a uploadfile video on youtube. The examples usually show uploading a file. I want to upload a file including other form data to the server.I know the move_upload_file function transfers a file to another file on the server but the problem is : I dont know how to relate the uploaded file to the phpmyadim tables that hold the other uploaded form information.
I will try upload the code soon.
Copy link to clipboard
Copied
Thread moved to Dreamweaver Application Development forum, which deals with PHP and other server-side issues.
As Ned says, you don't normally upload images to a database. However, if you have a particular reason to do so, you can find details in the Dreamweaver Cookbook:
The last of the three articles is probably the one you really want. It deals with uploading images to a website, but not putting them in a database.