Changing name of uploaded file in php -
i using code bellow upload file using php , inserting file name database. want rename of file on uploading , want insert new renamed name database. know how insert name database don't know how rename uploaded file name. please help. using code bellow:
$target = "uploads/"; $target = $target . basename( $_files['uploaded']['name']); move_uploaded_file($_files['uploaded']['tmp_name'], $target); $add_file = $_files['uploaded']['name'];
thank much..
is looking for?
<?php rename("/tmp/uploaded_file.txt", "/home/user/login/uploaded/67a7466b576.txt"); ?>
so new code be:
$target = "uploads/"; $target = $target . basename( $_files['uploaded']['name']); rename($_files['uploaded']['tmp_name'], $target); $add_file_to_db = $target;