PHP Image Upload

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maboroshi
Forum Commoner
Posts: 25
Joined: Thu Nov 13, 2003 10:10 am

PHP Image Upload

Post by maboroshi »

Hi I am experimenting with a small script that I am writing basically I have a form with these values name email comments image the image value is for uploading images this is all going into a database the image value in the database I specified as varchar because I had read it is better to specify the path to an image instead of loading the image into the database now in my php script when I pass the values I am stuck because I don't know how to specify the path so the database can read it would i just specify my image variable like this

Code: Select all

$image = "/path/to/my/folder";
then when I insert the image into the database would I just use the variable $image

anyhelp is appreciated cheers

Andrew
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Re: PHP Image Upload

Post by DuFF »

maboroshi wrote:Hi I am experimenting with a small script that I am writing basically I have a form with these values name email comments image the image value is for uploading images this is all going into a database the image value in the database I specified as varchar because I had read it is better to specify the path to an image instead of loading the image into the database now in my php script when I pass the values I am stuck because I don't know how to specify the path so the database can read it would i just specify my image variable like this
See, there's this thing called punctuation . . . could you please try to use it? :wink:

Anyway, the best way to do this is just to give a URL right to the image. SO something like this:

Code: Select all

$image = "http://www.yoursite.com/upload/image/image.jpg";
Post Reply