| | |
php upload mysql
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: May 2009
Posts: 18
Reputation:
Solved Threads: 0
Hi this is my first post on DaniWeb.... the information has helped me in the past but im seriously stuck.... Help would be very much appreciated..
Im trying to create a form where the user can upload 5 pictures to a mysql database (members) field names are img1, img2, img3, img4, img5.. i have read to design the img fields as varchar100 ??? and for my form to insert the location of the files?? into the database.
********upload form
*******
I'v got one file uploading to a "uploaded" folder
***see below
but what i dont understand is how i tell the database where the file is ?? and how do i show the file in a mysql query... I have my search working fine as the results are what im expecting them to be...
but these F'n images just will not show >> please please help
***my search
many many thanks in advance if anyone can help me...
Im trying to create a form where the user can upload 5 pictures to a mysql database (members) field names are img1, img2, img3, img4, img5.. i have read to design the img fields as varchar100 ??? and for my form to insert the location of the files?? into the database.
********upload form
html Syntax (Toggle Plain Text)
<html> <form action='upload.php' method='post' enctype='multipart/form-data'> <input type='file' name='myfile'> <input type='file' name='myfile1'><br> <input type='file' name='myfile2'> <input type='file' name='myfile2'><p> <input type='file' name='myfile4'> <input type='submit' value='upload'> </form> </html>
I'v got one file uploading to a "uploaded" folder
***see below
php Syntax (Toggle Plain Text)
<?php // properties of uploaded file $name = ($_FILES["myfile"]["name"]); //$name = $_FILES["myfile"]["name"]; //$name = $_FILES["myfile2"]["name"]; //$name = $_FILES["myfile3"]["name"]; //$name = $_FILES["myfile4"]["name"]; $type = $_FILES["myfile"] ["type"]; $size = $_FILES["myfile"] ["size"]; $tempd = $_FILES["myfile"] ["tmp_name"]; $error = $_FILES["myfile"] ["error"]; if ($error > 0) die ("Error uploading file code $error."); else { if ($type == "image/png" || $size > 500000) //file conditions { die ("File exceeds maximum file size limit of 0.5mb, saving the file as a JPG or GIF will reduce the overall size of the file"); } else move_uploaded_file($tempd,"uploaded/".$name); echo "Upload Completed"; { } // end if, after else } //end if b4 else ?>
but what i dont understand is how i tell the database where the file is ?? and how do i show the file in a mysql query... I have my search working fine as the results are what im expecting them to be...
but these F'n images just will not show >> please please help
***my search
php Syntax (Toggle Plain Text)
echo "$foundnum results found<br><p>"; while ($runrows = mysql_fetch_assoc($run)) { //get data $category = $runrows['catname']; //$subcategory = $runrows['subcategory']; $subcats = $runrows['subcats']; $catdes = $runrows['catdes']; $keywords = $runrows['keywords']; $imagelocation = $runrows['imagelocation']; $img2 = $runrows['img2']; //$img2 src='image/".$row['imagelocation']."' width='50' height='50'> //show data as search results echo " $category<p><br> $subcats<br> $catdes<br><p> $keywords<p> $imagelocation //enctype='multipart/form-data' $img2 <img2 src='image/".$row['imagelocation']."' width='50' height='50'> <img src='store/".$row['imagelocation']."' width='100' height='100' enctype='multipart/form-data'> $img2<p> ";
many many thanks in advance if anyone can help me...
Last edited by peter_budo; May 24th, 2009 at 3:19 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
why did I ever start.....
If you have helped me in the past, or you help me in the future.
I say thanks to you all
it is appreciated
If you have helped me in the past, or you help me in the future.
I say thanks to you all
it is appreciated
Mr. DaveyMoyes
you havent inserted the filename/path in to database while uploading. I this is why the file name is not showing.
Try inserting those img names to corresponding columns.
you havent inserted the filename/path in to database while uploading. I this is why the file name is not showing.
Try inserting those img names to corresponding columns.
•
•
Join Date: May 2009
Posts: 18
Reputation:
Solved Threads: 0
•
•
•
•
Mr. DaveyMoyes
you havent inserted the filename/path in to database while uploading. I this is why the file name is not showing.
Try inserting those img names to corresponding columns.
Can you help me on this please....
why did I ever start.....
If you have helped me in the past, or you help me in the future.
I say thanks to you all
it is appreciated
If you have helped me in the past, or you help me in the future.
I say thanks to you all
it is appreciated
plz dont get me wrong, i think u already know this.
but what to do this is the answer.
but what to do this is the answer.
PHP Syntax (Toggle Plain Text)
mysql_query("INSERT INTO table_name (member, img1, img2,img3) VALUES ($var1, $var2, $var3, $var4)");
![]() |
Similar Threads
- PHP & MySQL Error. Please help. (PHP)
- Need Assitance On Php & Mysql test. (PHP)
- Please I need help on image upload to mysql and display in browser (PHP)
- Upload image using PHP and AJAX (PHP)
- how to integrate PHP and Apache with mysql on linux (Linux Servers and Apache)
- 250 MB Disk / 40 GB Traffic Free PHP & MySQL Host (Web Hosting Deals)
- configure PHP to work with Mysql (MySQL)
Other Threads in the PHP Forum
- Previous Thread: admin
- Next Thread: Getting - 411 Length Required
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external fcc file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing pagerank paypal pdf php phpmysql play problem query question radio random recursion remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube





