Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Uploading images and editing stored images

Status
Not open for further replies.

spurs100

Technical User
Jun 5, 2002
20
GB
Hi everyone,

Hope someone can help shed light on this issue! I am working on a simple property database, i am fine returning all the records in the database as links. Clicking on the link will take me to a form which will allow me to edit the data for that record if i want. My question is, if i want to associate an image to this record what is the best way? i have been reading the forums, some suggest having a field with the location of the image, some suggest having a blob field. Any sugestions? Also how would i go about replacing a image that is already associated with a record with a new image if i wanted?

Hope i have made myself clear

thanks in advance to anyone who can clarify these issues for me, i am relatively new to PHP so dont be to hard on me if i ask stupid questions!!

 

i am relatively new to PHP so dont be to hard on me if i ask stupid questions

No question is stupid, everyone is new to anything at one point of time.

Anyway, i strongly recommend storing the location of the file in ur database and NOT to use blob field.
And if u want to replace the image of a particular record,u can very well makse use of UPDATE Statment of sql.



--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Hi spurs100,

I personally prefer storing images on the FTP and having only the file location string in the database. If you choose this option, you won't have to worry about the best format to store the image into the DB to and you will also be able to watch all the files located on the FTP and can delete or modify them by hand. The only problematic thing is the access rights issue. If you need to store some confidential data in the files then storing files in the DB will be the best choice. I only store images uploaded by my users so I can just 'chmod 766' the folder containing images and I don't need to worry about security.
 
Hi spookie/gizmicek,

there will be no confidential data, only images of properties.

I am using this tutorial as a basis of what i am trying to achieve:



What i am trying to achieve is a simple admin page that will allow the owner of the site to change an image associated to a property if needed, also how will i add the image location string when i do my Update statement.

I think i am OK capturing the image file and moving it from the temp dir to a folder i specify. i also think i need a field in my database "image location" which will contain the image location string to that image so when i do my Select query i will have all the info i need plus the image for that property will display.

hope this makes sense, any thoughts guys how i could achive this?

just thought of another example that might make more sense of what i trying to achieve!!!

lets say it was an employee directory and i wanted to replace the picture of a certain employee, how would i go about changing the image for that employee?

thanks a million
 
You can use the employee ID or name to as the main id field for the record, when you want to update that employee's image you need have a form, right? In this form, add a hidden (or not) field that shows the employee's ID and upload the image with this form. When the image is uploaded to the folder, update the db with the new image name (or over-write the old one) and that's it

hth

Bastien

Any one have a techie job in Toronto, I need to work...being laid off sucks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top