I've got a field that takes a URL in the form of 'http://.../somefile.jpg' (without quotes) and I'd like to somehow check that the URL to the image they've provided returns an actual image file. Is there any other way to do this, other than fopen ($_POST['url'])? Even using fopen(), would I be able to assure that the file returned is actually a JPEG?
Any suggestions would be greatly appreciated. In the meantime, I'll just allow broken URLs.
I think fopen() ,file() or file_get_contents() etc is the quickest way , as to the mime-type there is no way you can check this until you have the file on your system (other than simply assuming the extension is correct!) as you can't perform file operations on remote files.
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
I've got a field that takes a URL in the form of 'http://.../somefile.jpg' (without quotes) and I'd like to somehow check that the URL to the image they've provided returns an actual image file.
If you mean a form field, check out these threads:
__________________
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "
Thanks to the others, too. And they aren't uploading the file, they're just typing a URL.
Same difference.
-james
__________________
"God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "
MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)