php - how to rename file name while uploading -
i have file 2 input fields 1 file name (user type) , second 1 choosing file want upload file directory name user typed. down code i'm using guys please me how change file name user typed.
<?php $filename = $_post["file"] $upload = $_files['userfile']; $target_path = "upload/"; $target_path .= $upload["name"]; $newname = "anything"; if(move_uploaded_file($upload["tmp_name"], $target_path)) { echo "uploaded successfully"; } ?>
change $target_path .= $upload["name"];
$target_path .= $filename;
.
edit: record, have letting people upload files (and choose extension) web server raises serious security concerns. suggest @ least disabling ability execute scripts in target folder.
Comments
Post a Comment