Maybe I am a little confused here, so I'm gonna try to explain what I am seeing, along with the full code being used.
- In the HTML form: (where the user selects the file to upload)
<p align="left">PHOTO:
<input type="hidden" name="MAX_FILE_SIZE" value="100000000" />
<input type="file" name="photo" style="width: 222px;" / onKeyUp="highlight(event)" onClick="highlight(event)">
- The form processing script: (which tells the server what to do with all the information)
##### IMAGE HANDLING #####
// Where the file is going to be placed
$target_path = "uploads/images/";
/* Add the original filename to our target path.
Result is "uploads/images/filename.extension" */
$target_path = $target_path . basename( $_FILES['photo']['name'];
$_FILES['photo']['tmp_name'];
##### END IMAGE HANDLING #####
Now. The above code actually does upload the file to the server. How this is uploading the file is beyond me, because what I'm seeing and from everything I've read it should be something like this:
$HTTP_POST_FILES['photo']['name'];
copy($HTTP_POST_FILES['photo']['tmp_name'],
($HTTP_POST_FILES['photo']['name']);
So what I need to do with either of the codes is to have the file that is uploaded renamed automatically based on one of the server variables:
$_SESSION['constid']
and the input from a form field from the originating page:
$_POST['warnum']
which is passed from the original form to the .php file with the above name,
set up so that the file name once it is saved to the server would be:
constid _ warnum . jpg
What I can't figure out is how to change the code so that it renames the file to what I need it saved as, so that when the record is called from the database (which has a field in it where the file name is saved with the record) it will display the image file on the details page, along with the record that was accessed.
I think from the details page that I have created, it will call the image by specifying the image location as " uploads/images/['$photo'] "
I hope I am making sense here.... If not please tell me and I will clarify anything that I can.