azizmuda Posted March 18, 2011 Share Posted March 18, 2011 Hello everyone.i'm beginner in programming.How to make page that user can upload their own image.. my database table:product product_id (PK) product_price product_name product_picture anyone can help me..thank for advance:) Quote Link to comment Share on other sites More sharing options...
wepnop Posted March 18, 2011 Share Posted March 18, 2011 Hello everyone.i'm beginner in programming.How to make page that user can upload their own image.. my database table:product product_id (PK) product_price product_name product_picture anyone can help me..thank for advance:) You can use a html form that passes a file using input type=file, then you insert into the db. http://www.tizag.com/phpT/fileupload.php Here is well explained. Quote Link to comment Share on other sites More sharing options...
harristweed Posted March 18, 2011 Share Posted March 18, 2011 I used a little known technique to find this: http://php.about.com/od/advancedphp/ss/php_file_upload.htm What I did was to type “php upload script” into a secret search engine called Google. Please keep this information secret otherwise people will use it and it will get overloaded, break and I won't be able to use it any more. Quote Link to comment Share on other sites More sharing options...
azizmuda Posted March 18, 2011 Author Share Posted March 18, 2011 i done try on this tutorial but still not running..why the data not inserting into database... :'( Quote Link to comment Share on other sites More sharing options...
litebearer Posted March 18, 2011 Share Posted March 18, 2011 Show us your code Quote Link to comment Share on other sites More sharing options...
azizmuda Posted March 18, 2011 Author Share Posted March 18, 2011 this my code....help me please. this index file for insert the data. <code> <?php session_start(); ?> <?php $host = "localhost"; $username = "root"; $password = ""; $database = "upload_image"; $conn = mysql_connect($host, $username, $password) or die ("Could not connect"); $db = mysql_select_db($database, $conn) or die ("Could not select DB"); //query ?> <!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Dream in Code toturial</title> <style type="text/css"> label { float:left; text-align:right; margin-right:10px width:100px; color:black; } #submit { float:left; margin-top:5px; position:relativve; left:110px } #error { color:red; font-weight:bold; font-size:16pt; } </style> </head> <body> <div> <?php if(isset($_SESSION['error'])) { echo "<span id=\"error\"></p>".$SESSION['error']."</p></span>"; unset($_SESSION['error']); } ?> <form action="upload.php" method="post" enctype="multipart/form-data"> </p> <label>First Name</label> <input type="text" name="fname"/><br/> <label>Last Name</label> <input type="text" name="lname"/><br/> <label>Upload Image</label> <input type="file" name="image"/><br/> <input type="hidden" name="MAX_FILE_SIZE" value="100000"/> <input type="submit" id="submit" value="Upload"/> </p> </form> </div> </body> </html> </code> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.