After many frustrating hours and web searching I cannot figure out why the move_uploaded_file is appending the names of already already created files to the name of new files. As you will be able to tell from my code I an pretty new to PHP. However, I have a pretty large CSS form with the capability to upload 8 separate files (<input type="file" name="File1"/> name of each file from File1 to File 8.)
I am using the following code to upload the files to my pre-defined folder. The client names of the files that are being uploaded are (1.doc, 2.doc and 3.doc). The upload seems to work, however the files created on the server are named 1.doc, 1.doc2.doc and 1.doc2.doc3.doc
My problem is that I do not fully understand the use of the code and what [name] and [tmp_name actually do. Can anyone help?
php code...
$target_path = "../Filestore/";
$target_path = $target_path . basename( $_FILES);
move_uploaded_file($_FILES, $target_path);
$target_path = $target_path . basename( $_FILES);
move_uploaded_file($_FILES, $target_path);
$target_path = $target_path . basename( $_FILES);
move_uploaded_file($_FILES, $target_path);