Jump to content

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

 

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.