-5
以下ファイル入力および質問数は、各行に追加されたどのようにコードである:はここformタグを配置する
<form id="enter" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" onsubmit="return validateForm(this);" >
<div id="details">
<table id="qandatbl" align="center">
<thead>
<tr>
<th class="qid">Question No</th>
<th class="image">Image</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
</form>
:以下
var qnum = 1;
function insertQuestion(form) {
var $tbody = $('#qandatbl > tbody');
var $tr = $("<tr class='optionAndAnswer' align='center'></tr>");
var $qid = $("<td class='qid'>" + qnum + "</td>");
var $image = $("<td class='image'></td>");
var $imagefile = $('<input />')
.attr({
type: 'file',
name: 'imageFile',
class: 'imageFile'
});
$image.append($imagefile);
var $imageclear = $('<input />')
.attr({
type: 'button',
name: 'imageClear',
class: 'imageClear',
value: 'Clear File'
});
$image.append($imageclear);
$tr.append($qid);
$tr.append($image);
$tbody.append($tr);
}
は表の行をに追加されるテーブルであるが
私が知りたいことは、以下のコードをどこに置いてサーバーサイドのファイルをチェックすることができるのですか?私はフォームタグが必要なので、私が持っている現在のタグを置き換えることはできません。
<form enctype="multipart/form-data" action="uploader.php" method="POST">
$fileType = $_FILES['imageFile']['type'];
if (!in_array($fileType, $allowedImageTypes)) {
echo "Unsupported file type";
}
else
{
// Process the file
}
1つのフォームに2つのフォームタグを使用することはできません... – ceejayoz
2つのフォームタグを使用できない場合、このPHPコードを配置する場所はどのようなファイルタイプをチェックするのですか? – user1182476
元のフォームタグにenctypeタグを含めるだけで、同じページにphpを置く必要はありますか? – user1182476