I-AM-OBODO Posted March 4, 2011 Share Posted March 4, 2011 hi, i have a form that requires image to be uploaded. i know how to store the form values in a database but i don't know how to store the image into the database. i want the user to upload picture and preview the data provided review (including the image) before submitting to the database. thanks Quote Link to comment Share on other sites More sharing options...
litebearer Posted March 4, 2011 Share Posted March 4, 2011 Lot's of pros and cons regarding storing images in db as blob. http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/uploading-files-to-mysql-database.aspx Personally, prefer to store the images in folders, with image info in the db Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted March 5, 2011 Author Share Posted March 5, 2011 Lot's of pros and cons regarding storing images in db as blob. http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/uploading-files-to-mysql-database.aspx Personally, prefer to store the images in folders, with image info in the db yeah. i heard a person or argue about that. but i wonder which is the best practice considering bandwidth and server load? i have seen the link you gave me and thank you very much cos i got it working, but the problem is that i dont want to download the image rather i'd like when i want i can call any data and then i will see all the info for that person and then the picture included just like entering a form for school or visa lottery. thanks a great deal Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted March 6, 2011 Share Posted March 6, 2011 Images are files, and the filesystem is well suited for storing files, whereas databases are well suited for the storage of data. What do you mean you don't want to download the image? It has to be downloaded to be displayed. Quote Link to comment Share on other sites More sharing options...
litebearer Posted March 6, 2011 Share Posted March 6, 2011 upload image - requires bandwidth and server processing store image - require space whether its in a db as a blob or in a folder display image from db requires bandwidth display image from folder requires bandwidth ease of displaying image from db - for me TOUGH ease of displaying image from folder - NO BRAINER you decide. Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted March 6, 2011 Author Share Posted March 6, 2011 Images are files, and the filesystem is well suited for storing files, whereas databases are well suited for the storage of data. What do you mean you don't want to download the image? It has to be downloaded to be displayed. 'I dont want to download image' i mean i want the image to be displayed in preview format and not like dowloading to store or something. Hope am making myself clear. Still that brings us back. How do i get it done (saving on folder and url in db) Thanks Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted March 6, 2011 Share Posted March 6, 2011 No, it still isn't really clear what you're asking. Are you talking about a thumbnail preview of the image, which you'd then link to the full size image? In either case, the browser can't display the image without downloading it. Quote Link to comment Share on other sites More sharing options...
I-AM-OBODO Posted March 7, 2011 Author Share Posted March 7, 2011 No, it still isn't really clear what you're asking. Are you talking about a thumbnail preview of the image, which you'd then link to the full size image? In either case, the browser can't display the image without downloading it. The image to be uploaded is limited to a passport size photograph. the user fills a form containing his/her data and browse for a passport in the area provided and clicks upload, he sees the passport in the area meant for passport and then clicks submit so that the data gets to the database. the admin on the other hand queries for a user and gets the data of the specific query including a view of the image. <form action="" method="post" enctype="multipart/form-data" name="form1" id="form1"> <table width="69%" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="13%">Name:</td> <td width="29%"><input name="name" type="text" id="name" /></td> <td width="58%" rowspan="5" valign="top"><table width="38%" height="118" border="1" cellpadding="0" cellspacing="0"> <tr> <td align="center">Passport</td> </tr> </table></td> </tr> <tr> <td>Sex:</td> <td><select name="select"> <option selected="selected">Sex</option> <option>Male</option> <option>Female</option> </select> </td> </tr> <tr> <td>Email:</td> <td><input name="emal" type="text" id="emal" /></td> </tr> <tr> <td>Address:</td> <td><input name="address" type="text" id="address" /></td> </tr> <tr> <td>Phone:</td> <td><input name="phone" type="text" id="phone" /></td> </tr> <tr> <td> </td> <td> </td> <td><input type="file" name="file" /> <input name="Upload" type="submit" id="Upload" value="Upload" /></td> </tr> <tr> <td rowspan="2"> </td> <td> </td> <td> </td> </tr> <tr> <td><input type="submit" name="Submit" value="Submit" /> <input name="Reset" type="submit" id="Reset" value="Reset" /></td> <td> </td> </tr> </table> </form> 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.