Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 9th, 2003, 03:27 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Picture to MySQL

I wanna ask how can we upload picture to database?

Reply With Quote
  #2 (permalink)  
Old July 9th, 2003, 03:05 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you successfully been able to upload files to your webserver? If not, there's a tutorial in the PHP manual online:
  http://www.php.net/features.file-upload

If you're just having problem inserting the file data into a database, I suggest you read this similar thread:
  http://p2p.wrox.com/topic.asp?TOPIC_ID=1495


Take care,

Nik
http://www.bigaction.org/
Reply With Quote
  #3 (permalink)  
Old July 10th, 2003, 03:45 AM
Registered User
 
Join Date: Jul 2003
Location: , , Netherlands.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would like to suggest you rethink your strategy. I'm assuming you're using MySQL for your database (as most PHP programmers tend to use this). Databases aren't built for storing binary data in this way and, if you're expecting any decent amount of traffic, it may even noticably slow down your site.

This is what filesystems are made for.

I'd suggest storing a pathname to the actual image in the database, and then either:

a) doing a header('Content-type: image/image-type'); passthru($path_to_image); (this only if the images are outside your web document root). This script would then be referenced in an img tag.

or

b) storing the paths as relative to your web document root and including them in img tags.



Kind regards,


Devon H. O'Dell
sitetronics.com
Reply With Quote
  #4 (permalink)  
Old July 11th, 2003, 03:50 AM
Authorized User
 
Join Date: Jun 2003
Location: , , Germany.
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Devon,
Quote:
quote:
Databases aren't built for storing binary data in this way and, if you're expecting any decent amount of traffic, it may even noticably slow down your site.
I would agree to a certain degree. There are also advantages to this approach.

You don't have to deal with inconsistencies when storing in a db.
You have better access control.
It seems to be in line with relational db theory

I don't know if this can be applied fully for MySQL, but an in depth explanation of using BLOB's in a DB (MS SQL Server) can be found here

http://www.microsoft.com/technet/tre...art3/c1161.asp

Have fun!

Cheers,
Frank
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Picture Box harfani VB.NET 2002/2003 Basics 0 August 6th, 2007 08:36 AM
How to upload a picture grstad Classic ASP Databases 5 February 28th, 2006 02:20 PM
inserting picture p_gauri7 Crystal Reports 1 February 21st, 2005 07:25 AM
picture rajuru PHP Databases 1 October 18th, 2004 08:56 PM
OLE picture - accessing the picture property bdcrisp Excel VBA 0 December 7th, 2003 09:35 PM



All times are GMT -4. The time now is 08:09 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.