VoodooJai Posted May 16, 2010 Share Posted May 16, 2010 I am trying to hide a files name so that the source cannot be identified by others. So far I have this which disguises the filename but wont show the image. <?php $secret = "asdflyu345iu2y35ui345"; $fileName = "picture.png"; $hash = md5($fileName . "|" . $secret); $url = "images/adverts/$hash"; echo "Filename: ".$fileName."<br/>"; echo "The FileName hash: ".$hash."<br/><br/>"; echo "The URL: ".$url."<br/>"; echo "Hashed image shown here! <img src=".$url." width=\"99\" height=\"64\" \/>"; echo " and image should be this! <img src=\"images\/adverts\/picture.png\" width=\"99\" height=\"64\">"; ?> There is some debug code in there as well. Many thanks in advance VoodooJai Link to comment https://forums.phpfreaks.com/topic/201946-hiding-a-files-name/ Share on other sites More sharing options...
teamatomic Posted May 16, 2010 Share Posted May 16, 2010 The file needs a valid extension. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/201946-hiding-a-files-name/#findComment-1059119 Share on other sites More sharing options...
VoodooJai Posted May 16, 2010 Author Share Posted May 16, 2010 Having changed the extension to a valid one and found a few errors that were corrected the code now looks like this <?php $secret = "asdflyu345iu2y35ui345"; //choose your own $fileName = "stock.jpg"; $hash = md5($fileName . "|" . $secret); $url = "$hash"; echo "Filename: ".$fileName."<br/>"; echo "The FileName hash: ".$hash."<br/><br/>"; echo "The URL: ".$url."<br/>"; echo "Hashed image shown here! <img src=\"Stockists/".$url." \" width=\"99\" height=\"64\">"; echo " and image should be this! <img src=\"Stockists/stock.jpg\" width=\"99\" height=\"64\">"; ?> the hidden filenames image does not still display. VoodooJai Link to comment https://forums.phpfreaks.com/topic/201946-hiding-a-files-name/#findComment-1059141 Share on other sites More sharing options...
kenrbnsn Posted May 16, 2010 Share Posted May 16, 2010 What are you hoping to accomplish with this? Do you have a file in the directory that's the same name as the hashed name? If not, this is not going to work. Ken Link to comment https://forums.phpfreaks.com/topic/201946-hiding-a-files-name/#findComment-1059143 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.