Images Question

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
dirkr
Forum Newbie
Posts: 20
Joined: Sat Jul 07, 2007 2:55 pm

Images Question

Post by dirkr »

i was working on a little script to upload images and i noticed something strange ( but maybe usefull ).
i forgot to add an extension so my file ended up named like this "36." and strangly enough when i call it in a different page with
<img src=36.></img> it actually works..

when i remove the . so it just becomes "36" then it fails..
for me this could be usefull cause i wouldnt have to check if they upload a file with the same name but with a different extension cause it would all be named the same ( no extension )

anybody know anything about this? it seems to work..but is there anything i might be missing that could go wrong or something?
User avatar
arturm
Forum Commoner
Posts: 86
Joined: Fri Apr 13, 2007 8:29 am
Location: NY
Contact:

Post by arturm »

you can have
<img src=36.php></img>
and as long as you have proper headers and content in this php file it will work as well but it depends on server configuration if this file will be interpreted or just send in plain text.
dirkr
Forum Newbie
Posts: 20
Joined: Sat Jul 07, 2007 2:55 pm

Post by dirkr »

nah its not even .php .. its just "."
and it seems to work.. tested in IE and FF.. it has no extension :)
User avatar
arturm
Forum Commoner
Posts: 86
Joined: Fri Apr 13, 2007 8:29 am
Location: NY
Contact:

Post by arturm »

extension is only important on a server side - this way server knows what to do with it: send it to the browser, parse it and send, execute etc.
for browser file extension is not important - it looks for file headers only
dirkr
Forum Newbie
Posts: 20
Joined: Sat Jul 07, 2007 2:55 pm

Post by dirkr »

well so far it seems to work fine without an extension
( file is saved without on on the server but displayed propperly in the browser wen called thru a html tag )
guess i'll see what happens :)

thanks for the info on it tho :)
Post Reply