- Receive the title in your PHP script using
$_POST['pt_doc_title']
- Use
strtolower()
to convert the title to lowercase - Use
str_replace()
to replace all spaces with underscores - Use
rename()
function to rename the file uploaded by the user
This should get you started:
if (isset($_POST['submit'])) {
$title = $_POST['pt_doc_title'];
$title = strtolower($title);
$title = str_replace(' ', '_', $title);
// do additional checks and rename the file
}