Jump to content

[SOLVED] Image upload store with origanal File name


big-dog1965

Recommended Posts

 

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);

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.