I have a page using forms to help build listing templates for eBay. I have a folder where I have hundreds of logos stored. I know the logo names but not their extensions. . . . I have to test each potential (jpg, jpeg, gif, png, etc.) until I guess right. Here is an example code for the web form:
<form action="extension_test2.php" method="post">
<p>Logo: <input name="e" value="" type="text" size="15" maxlength="30" /><p>
<input name="Submit" type="Submit"/>
</form>
and the form's result:
<?
$e =$_POST['e'];
if(!empty($e)) {
echo '<img src="http://www.gbamedical.com/ebayimg/logos/'.$e.'">';
};
?>
Here is a link to the example: http://www.gbamedical.com/extension_test.php Use "olympus.jpg" for test.
I am looking for code that can determine the file type and dynamically add the extension. Can it be done?
I asked the question in a different, apparently confusing way here: Known image file name on internet host folder . . . unknown file extension. . . How to extract The answer I received showed code (The code worked with outside image examples given but doesn't work with images hosted on my server) that does not require the extension to echo the image. . .. but, I need the extension to be echoed as well because I ultimately copy the code of the resulting html page in an eBay page.