我正在開發一個symfony項目,並且我開發了一個表單來上傳文件並將其信息保存到我的模型中的表中。並沒有使用sfForm類來實現我的表單。 這裏有我的形式Symfony:沒有sfForm對象的表單域訪問
<form name="new_file" action="<?php echo url_for('home/uploadFile');?>" method="post">
<input type="file" id="file">
<input value="<?php echo $codigo_maestro?>" id="master_id">
<input value="<?php echo $codigo_entidad?>" id="entity_id">
<input type="submit" value="Upload">
</form>
所以現在我試圖訪問sumbited表單的字段在我的動作功能,不知道這個代碼是如何:(
$request->getParameter('file');
$request->getParameter('master_id');
$request->getParameter('entity_id');
沒」將不起作用。 所以請幫我解決這個!如何訪問我的表單字段從動作?
您應該使用表單框架。這不是你應該怎麼做symfony中的表格。 – Flukey