Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Uploading files to phpmyadmin

Explorer ,
Jan 10, 2010 Jan 10, 2010

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.

TOPICS
Server side applications
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2010 Jan 10, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 10, 2010 Jan 10, 2010
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2010 Jan 10, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines