Important alert: (current site time 7/15/2013 11:22:16 AM EDT)
 

winzip icon

Storing / Retrieving pictures from database

Email
Submitted on: 7/21/2002 6:03:00 AM
By: Imthiaz Rafiq  
Level: Beginner
User Rating: By 9 Users
Compatibility: PHP 3.0, PHP 4.0
Views: 25194
author picture
(About the author)
 
     Hi folks I have searched many sites for storing a picture into a database and retrieve the same. But I got some tutorials when I searched the web. Using the tutorials I have a made one for me. It was implemented using Php and Mysql. I will tell you want is the job of each files. 1). index.php This files links all the files in the project. 2). store.php This does the job of storing the picture into the database. 3). viewadd.php This file shows the entire picture stored in the database. 4). getpicture.php This file actually gets the file from file in the form of picture 5). mdbc.inc.php This is a class file for Mysql feel free to use. I got this over net. Here is the table description Id - > has the picture id Description -> has the picture description bin_data -> picture data filename -> picture file name filetype -> picture file type. Like gif or jpeg etc link -> you can store the link incase if you want to use this for ad exchange showno - > no of time ad show etc clickcount -> no of time the ad being clicked etc Query for the table. CREATE TABLE ads ( id varchar(15), description varchar(255), bin_data LONGBLOB, filename varchar(50), filesize varchar(50), filetype varchar(50), link varchar(255), shownno integer(5), clickcount integer(5), unique(id) ); If you want to see a site where I have implemented please have a look at the site http://www.asksathia.com/ Feel free to change anything in the code. If you developed a better version than this please send me the source code so that I may update myself. It took me much time when commenting the code of ease of understanding. Please vote for me. Regards Imthiaz Rafiq imthiazrafiq@gmx.net Msn id: imthiazrafiq@gmx.net Yahoo id: imthiazrafiq ICQ: 24294947 URL: http://high-flyer.da.ru/

 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 2 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

7/21/2002 10:29:43 PMRavoof

Cool Code .....
Keep the good work going...
The code was well commented, Thanks
(If this comment was disrespectful, please report it.)

 
7/22/2002 6:47:09 AMvisagan

Fine
It helped me in the way I want
Keep it up.
Introduction is more nice.

(If this comment was disrespectful, please report it.)

 
9/20/2002 7:27:19 PM

Sorry folks I can't find the code to comment on!! Where is it???

Thanks
Dick
(If this comment was disrespectful, please report it.)

 
1/27/2003 5:06:13 AM

Was good for beginners.thats always a good thing !!
(If this comment was disrespectful, please report it.)

 
1/13/2004 10:04:27 AM

hello, this is really good work, but while i tried to add ads: (link to store.php)

everything is doing fine but there has got one little flaw appears on the top while i launce to 'store.php'.

Warning: Undefined variable: submit in c:\program files\apache group\apache\htdocs\upload\store.php on line 8

anything i can do to overcome it?
(If this comment was disrespectful, please report it.)

 
2/24/2004 4:15:04 AM

Very nice code to my web based project
(If this comment was disrespectful, please report it.)

 
10/30/2004 4:11:20 AM

I did not check it. Although thanks a lot for this grat effort.
(If this comment was disrespectful, please report it.)

 
8/6/2006 12:04:09 PMOsama Alex

Frankly, even before I start use your codes, the Class.php file is so complex as I can't understand many lines of it!
Kindly, publish a lite version, which have some simple class.php file
(If this comment was disrespectful, please report it.)

 
2/25/2007 4:57:59 PMJames M

Hello.. Keep up the good work! 5 stars!

J
(If this comment was disrespectful, please report it.)

 
8/16/2007 1:08:07 AMnirav

very easy and unstandcode
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.