big-dog1965 Posted May 21, 2009 Share Posted May 21, 2009 I think this is the bit of code that is doing the file upload portion of a form/php process. I need the file to be stored with the original file name. Right now it is stored with a name I can’t retrieve from DB with out looking at the folder after it is uploaded. My scenario is I’m displaying information from the DB on a webpage by echoing it. I would like to display the image as well, but how. So first I want to tackle the storing of image with real file name. // File upload handling if($_FILES['venues_field_15']['name']!=''){ $venues_field_15_filename = "file_15_".date("sihdmY").substr($_FILES['venues_field_15']['name'],strlen($_FILES['venues_field_15']['name'])-4); if(!move_uploaded_file($_FILES['venues_field_15']['tmp_name'], "./files/".$venues_field_15_filename)){ die("File " . $_FILES['venues_field_15']['name'] . " was not uploaded."); Im thinking this is the area of code that I want to change but dont have a clue. tried several things and all failed. $venues_field_15_filename = "file_15_".date("sihdmY").substr($_FILES['venues_field_15']['name'],strlen($_FILES['venues_field_15']['name'])-4); Link to comment https://forums.phpfreaks.com/topic/159177-solved-image-upload-store-with-origanal-file-name/ Share on other sites More sharing options...
.josh Posted May 21, 2009 Share Posted May 21, 2009 $venues_field_15_filename = $_FILES['venues_field_15']['name']; Link to comment https://forums.phpfreaks.com/topic/159177-solved-image-upload-store-with-origanal-file-name/#findComment-839464 Share on other sites More sharing options...
big-dog1965 Posted May 21, 2009 Author Share Posted May 21, 2009 So the line I thought was the line to mod is right and I just need to delete like this? $venues_field_15_filename = "file_15_".date("sihdmY").substr($_FILES['venues_field_15']['name'],strlen($_FILES['venues_field_15']['name'] )-4) ; Link to comment https://forums.phpfreaks.com/topic/159177-solved-image-upload-store-with-origanal-file-name/#findComment-839475 Share on other sites More sharing options...
.josh Posted May 21, 2009 Share Posted May 21, 2009 obviously. Link to comment https://forums.phpfreaks.com/topic/159177-solved-image-upload-store-with-origanal-file-name/#findComment-839480 Share on other sites More sharing options...
big-dog1965 Posted May 21, 2009 Author Share Posted May 21, 2009 Tried it, it worked Thank you. spent a lot of time trying to mod it you made it very simple guess I once again was over thinking things Thank you Link to comment https://forums.phpfreaks.com/topic/159177-solved-image-upload-store-with-origanal-file-name/#findComment-839483 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.