Lassie Posted March 1, 2011 Share Posted March 1, 2011 I want to save an image with a unique name that is created from a hash function. How can I cretae the path with the variable... $hash=$_GET['hash']; $path ="/Applications/MAMP/htdocs/test_upload/images/imagename2.png"; //becomes $path ="/Applications/MAMP/htdocs/test_upload/images/'.$hash.'.png";? Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted March 1, 2011 Share Posted March 1, 2011 $hash = substr(md5(uniqid(rand(), true)), 0, 20); $path = "/Applications/MAMP/htdocs/test_upload/images/".$hash.".png"; rename("/Applications/MAMP/htdocs/test_upload/images/imagename2.png", "/Applications/MAMP/htdocs/test_upload/images/".$hash.".png"); Quote Link to comment Share on other sites More sharing options...
Lassie Posted March 1, 2011 Author Share Posted March 1, 2011 Thanks thats done it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.