php - Rename image on upload -
i rename image when uploaded.
the url of upload page upload.php?clientid=123456 , save image 123456.jpg
here upload code
if (move_uploaded_file($_files["filetoupload"]["tmp_name"], $target_file)) { echo "the file ". basename( $_files["filetoupload"]["name"]). " has been uploaded."; } else { echo "sorry, there error uploading file."; }
is possible?
(newbie)
you're saving file:
move_uploaded_file($_files["filetoupload"]["tmp_name"], $target_file)
just first set $target_file
whatever want name of file be.
$target_file = "/some/path/to/a/file.jpg";
or
$target_file = "/some/path/with/a/$variable.jpg";
the move_uploaded_file()
function going save (or @ least try to) file whatever name in second function parameter. provide name want file have.
Comments
Post a Comment