Jump to content


Checking A URL


2 replies to this topic

#1 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 05 August 2008 - 02:17 AM

I have made my own custom forums, and i gave the user an option to enter an image url. How can i check the last couple of characters to make sure they are the extentions .gif, .jpg, .png, or .jpeg, with javascript?

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 05 August 2008 - 12:05 PM

Google the match() function. It uses regex, but would probably be the simplest method and would work like any PHP equivalent.

As usual though, don't rely 100% on the user even having JS enabled.

#3 Hip Hop Artist

    Young Padawan

  • Members
  • Pip
  • 152 posts
  • Gender:Male
  • Location:Canada

Posted 05 August 2008 - 01:37 PM

ok thanks.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users