Jump to content


Photo

I have Image upload questions....


  • Please log in to reply
5 replies to this topic

#1 drranch

drranch
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 02 September 2006 - 12:13 AM

???

Hello all!

I'm not sure I understand this image upload process for PHP/MYSQL....

I undestand that you can upload an image to a folder, but how do you tie the item in the MYSQL database to it's specific image? 

???


#2 bob_the _builder

bob_the _builder
  • Members
  • PipPipPip
  • Advanced Member
  • 207 posts

Posted 02 September 2006 - 12:24 AM

Hi,

Store the filename.extension in your databse .. then you use that to match the image name to the image

<img src="'.$images_dir.'/'.$row['photo_filename'].'">';


hth

#3 drranch

drranch
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 02 September 2006 - 12:29 AM

The "$images_dir.."  would that be where my host provider set up the temp directory for?

Host php.ini configuration...

upload_tmp_dir C:\WINDOWS\Temp



#4 bob_the _builder

bob_the _builder
  • Members
  • PipPipPip
  • Advanced Member
  • 207 posts

Posted 02 September 2006 - 12:31 AM

Nope that will be the path to where you shifted the image upon upload:

$images_dir = 'images/gallery';


hth

#5 drranch

drranch
  • Members
  • PipPipPip
  • Advanced Member
  • 78 posts

Posted 02 September 2006 - 12:37 AM

I think I found a pretty good tut on this...after reading the first two pages your advise is more clear in my head!

http://codewalkers.c...rials/35/1.html

Thank you for your knowledge and time!

#6 bob_the _builder

bob_the _builder
  • Members
  • PipPipPip
  • Advanced Member
  • 207 posts

Posted 02 September 2006 - 09:05 PM

Hi,

Looks like that tut shows how to store the images within the database .. Im sure the best option is to store the name+extension in the database and the photo/file in a folder on the server.

Post what code you have if you get stuck.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users