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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if image or text

Status
Not open for further replies.

blasterstudios

Technical User
Dec 30, 2004
128
US
I am trying to store the image filename in my database for a given field. The user has the option of using an image for a field or inputing text. I need to be able to check if the text in the field is an image or actual text. The field type is LONGTEXT and basically if its an image, it will just say "blah.gif" or "blah.jpg". If its text, it will have way more text in the field or may just say "leave empty" or something. How do i check to see if the text in the field is the filename of an image or just plain text?
 
You've said, "The user has the option of using an image for a field or inputing text." What do you mean by this? Is the user presented an input of type "file"?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Well, on the page that updates this record they must select image or text, and if they select image, they are presented with a dropdown box that has a list of their stored images. If they choose text, they're given a text box to type their text.
 
I'd add a field to the db, type int(1) ENUM('0','1') and set to 0 for image, 1 for text, you can easily figure out whats in there then.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
I thought about that and was going to do it if i can't figure out a different way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top