When I upload and move_uploaded_file() the file ends up named after the NAME field on the html page. I know - no big surprise. But how do I get to automatically be named what the file was named when it was uploaded? I'm sure it has something to with basename(), but i don't know how to implement it. I've looked at the manual and every tutorial i could find, and everybody seems pleased as punch that the file is named after the NAME field, and not its original name.
in closing, my file gets where its going, i just need to know how give the move_uploaded_file() the file's original name.
thanks for the help 😕
$file_dir = "/home/httpd/vhosts/babysteps.tv/httpdocs/counterpoint/uploads";
$file_url = "http://babysteps.tv/counterpoint/uploads";
foreach( $_FILES as $file_name => $file_array ) {
print "path: ".$file_array['tmp_name']."<br>\n";
print "name: ".$file_array['name']."<br>\n";
print "type: ".$file_array['type']."<br>\n";
print "size ".$file_array['size']."<br>\n";
move_uploaded_file( $file_array['tmp_name'], "$file_dir/$file_name" )
or die ("Couldn't Copy");
}