可能な重複形成:私のアップロードフォームは、私が4文字という名前のファイルのみを受け入れるようにしたいはHTMLファイル形式のアップロードを指定
<form action="chainresult.php" method="post" enctype="multipart/form-data" /> <div> Upload a PDB file : <br /> <input type="hidden" name="MAX_FILE_SIZE" value="10485760"/> <input type="file" name="userfile" id="userfile" size="50000000" /><br /> <input type="submit" value="GET SEQUENCE" /> </div> </form>
ある
How to restrict <input type=“file”> so that it can only select .pdf files?
を。 "ABCD.pdb"のようにpdb extentionは、どのように私はこれを達成することができますか?
upload.phpあなたは選択肢を持っている
<?php
$upfile = 'uploads/'.$_FILES['userfile']['name']; if (is_uploaded_file($_FILES['userfile']['tmp_name']))
{
if (!move_uploaded_file($_FILES['userfile']['tmp_name'],upfile))
{
echo 'Problem: Could not move file to destination directory';
exit;
}
}
else
{
echo 'Problem: Possible file upload attack. Filename: ';
echo $_FILES['userfile']['name'];
exit;
} ?>
chainresult.phpにはどのようなコードがありますか? –
http://stackoverflow.com/questions/4634159/how-to-restrict-input-type-file-so-that-it-can-only-select-pdf-files http://stackoverflow.com/questions/ 4328947/limit-file-format-when-use-input-type-file http://stackoverflow.com/questions/7897576/restrict-file-type-and-size-in-php-form-upload – random