I have an input box where I type the name of the file. I want the input box to require me or other users to input also what type of file it is.
For example, when I just type this_is_name_of_file to the input box and submitted it. It should return false.
Is there a way for it to accept only when I type it as name_of_file.pdf or name_of_file.docx wherein I type the name of file with its file extension.
This is the input tag inside my form:
<label>File Name: </label>
<input class="input2" type="text" name="filename"
placeholder="file.pdf/xlsx/xls/docx" required autofocus><br>
This is my php file:
$FName = $_POST['filename'];
$pdoQuery = "INSERT INTO `report`(`filename`) VALUES (:FName)";
$pdoResult = $pdoConnect->prepare($pdoQuery);
$pdoExec = $pdoResult->execute(array(":FName"=>$FName));