I'm in the process of learning php in a class and had a quick question for one of my assignments. I am uploading a file to a server which the user can name the directory. However, after they upload the file, I have to give them the option to either rename the file or delete it. I'm having a hard time accessing the original file name on the page that I link to rename the file. I tried using the super global files thinking that it doesn't get wiped after you leave the first page, but its not working.
I've also tried using a session to remember the the filename. userfile_name is a variable. In my upload page, I do this in the very beginning:
<?php session_start(); session_register("userfile_name"); ?>
$userfile_name = $_FILES[userfile][name];
Then on the rename page, I do this at the very beginning:
<?php session_start(); $user_file = $_SESSION[userfile_name]; ?>
But in the response page, I get a warning with rename that shows only the second parameter, which is a local variable on the page that the user enters what they want to rename the file to, makes it. The first parameter, original file name that I tried to save with a session didn't.
Thanks a bunch. If I can get this working I can use the same procedure for delete.