How to move uploaded files to permanent directory?
Answer / Vikrant Nimesh
In PHP, after saving an uploaded file using the move_uploaded_file() function, you can copy it to a permanent directory using the copy() function. Here's an example:nn```phpn// Save the uploaded file temporarilynif (isset($_FILES['file'])) {n$target_dir = 'temp/';n$target_file = $target_dir . basename($_FILES['file']['name']);nmove_uploaded_file($_FILES['file']['tmp_name'], $target_file);}n// Copy the temporary file to the permanent directorynif (isset($target_file)) {n$target_dir_permanent = 'permanent/';ncopymove($target_file, $target_dir_permanent . basename($_FILES['file']['name']));}n``
| Is This Answer Correct ? | 0 Yes | 0 No |
What is use of mysqli_query in php?
Explain me what are the 3 scope levels available in php and how would you define them?
What is mod_php?
Can php use gettext?
What is php's mysqli extension?
What is string and its function?
How to Define a Constant in PHP? Is $ symbol necessary?
Explain PHP?
How to test if a variable is an array?
Tell me what is the default session time in php?
How to remove the new line character from the end of a text line in php?
List data types in PHP?