473,471 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to store Image into databse

25 New Member
Please give me sample code to insert image into database


regards
madhu
Aug 28 '07 #1
6 1263
FrEaKmAn
46 New Member
well this doesn't really answer your question, but why do you want to store image in db? as I know, it's not such a good idea..
Aug 28 '07 #2
ak1dnar
1,584 Recognized Expert Top Contributor
Please give me sample code to insert image into database


regards
madhu
You have to use mysql blob data type for store images.
Please read through this tutorial first and post back questions if any.
Aug 28 '07 #3
mwasif
802 Recognized Expert Contributor
You may find this post useful.
Aug 28 '07 #4
ronnil
134 Recognized Expert New Member
well this doesn't really answer your question, but why do you want to store image in db? as I know, it's not such a good idea..
Personally i don't think it's such a bad idea, as long as your site isn't visited as much. The reason it's a bad idea is that it's a really slow process reading so much data from a database.
BUT for security reasons, this could very well be a good idea since the only way you can access the pictures, is through a server side language.

If possible, it's better to store images and files over you webroot, and then access them stil through php, this is a quicker way to do it, and you can still stop people from leeching and that kind of things.
Aug 28 '07 #5
pbmods
5,821 Recognized Expert Expert
Heya, Madhu.

TSDN members are expected to write their own code. We're happy to help you out if you have specific questions, but you can't realistically expect someone to do your coding for you on a free forum.
Aug 28 '07 #6
MarkoKlacar
296 Recognized Expert Contributor
When creating your table create all the fields you need, as well a MEDIUMBLOB for storing you image.

When uploading the image specify you SQL-query so that the variable containing the image is sent in to the database just as you would send a string or integer. Pretty simple, just treat it as any other entry.

Retrieveing the image is a bit more complicated, are you going to need help with this as well?
Aug 29 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: doffer | last post by:
I want to make a portfoliosystem where user can register and get their own portfolio... I've started the developer work, but I'm stuck on the image upload part... I'm experiencing some problems...
6
by: Rudy | last post by:
Hello all! I am amazed how many posts I have read to store an image in SQL, and just as many against it. So I learned how to store an image in a SQL db and retrieve the image. A little tricky,...
5
by: moondaddy | last post by:
I'm caching a dataset in an asp.net session variable to hold a user's data. one data item I need to store is an image the user uploaded. My problem is that I don't know how to get the image into...
2
by: nittin14 | last post by:
hello guys, pls solve my problem my problem is that i m retreive data from table but in some column the value is store NULL. i want that insist of NULL it wl display some text in datalist while...
4
by: nma | last post by:
<td width="65" valign="top" width="65" height="44" border="1" vspace="2"><img src="<?php echo $row;?>"></td> <td width="195" class="eventEntryText" ><b><? echo " SHOT : $shotNumber";?><br...
9
by: Ajinkya | last post by:
Hello friends ! , I am very new to java script.If anyone can help me then I will be very very thankful to his/her. I am using php and mysql in my project and I have one textarea and one...
9
by: shailajaAdiga | last post by:
Hi All.. images are stored in database(imagecontent and image type is stored).Currently i have displayed the image in popup window (no size limits to window). I would like to get the image size...
16
ribbo
by: ribbo | last post by:
What I need in a nutshell is a form that will allow me to upload multiple pictures (say 5) to my server while at the same time saving the names to the MySQL database. I would prefer it if the image...
1
by: rawat | last post by:
i update the image in a databse . how updation image . firstly i create a folder upload in a root directory. i create path in database table. how can update the image by...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.