Current location: Hot Scripts Forums » Programming Languages » PHP » Looking for a script to upload images in a database.


Looking for a script to upload images in a database.

Reply
  #1 (permalink)  
Old 06-16-03, 02:19 AM
boskyvora boskyvora is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Looking for a script to upload images in a database.

Hi There,

I need a script to upload images to my MySQL server. Can anyone help me or guide me, n tell me where i can find it?

Regards,
Bosky
Reply With Quote
  #2 (permalink)  
Old 06-16-03, 02:31 AM
DuEy's Avatar
DuEy DuEy is offline
PHP is my life.
 
Join Date: Jun 2003
Location: New Zealand
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
well the mysql database would need a Blob field for a start. Code is something like this (after uploaded to server)

PHP Code:

<?

$file 
fopen("image.jpg""r");
$image addslashes(fread($filefilesize("image.jpg")));
$con mysql_connect("localhost","nick","ihateperl");
mysql_select_db("database");
$query 'INSERT INTO `images` (`image`) VALUES (\''.$image.'\');';
mysql_query($query) or die(mysql_error());
fclose($file);
?>
something like that.
__________________
-Duey
server: irc.chatchannel.org
channel: #hotscripts

Last edited by DuEy; 06-16-03 at 02:33 AM.
Reply With Quote
  #3 (permalink)  
Old 06-16-03, 04:18 AM
phpkid phpkid is offline
Hot Moderator ;)
 
Join Date: Jun 2003
Location: India
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Mostly, it's not good idea to store image file contents directly in MySQL server.

Check out if you can you do away with storing path of the image file instead.

Regards,
JD
__________________
http://www.phpkid.org
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
upload script cabj1981 PHP 43 03-04-04 03:19 PM
error when creating database tables with php script spiroth10 PHP 4 01-06-04 03:59 PM
Picture upload to database? dayzeday PHP 9 10-09-03 01:14 AM
Image Upload Script GrimShadow PHP 1 09-26-03 05:18 PM
dropdown list from database and with images redspider ASP 4 07-30-03 06:13 AM


All times are GMT -5. The time now is 05:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.