0
你好,我試圖創建一個Zend_Form的表單,這將使我的用戶能夠上傳一個無限數量的文件到我的網站,女巫是由JavaScript完成的。Zend表格和動態文件上傳
喜歡的東西
<script type="text/javascript">
$(document).ready(function(){
var image_uploade_i = 0;
$('#upload_more').click(function() {
image_uploade_i++;
$('#upload_list').append('<div id="image_uploade_id_'+image_uploade_i+'" style="display: none;"><input type="file" name="image[]" /><br /></a>');
$('#image_uploade_id_'+image_uploade_i).slideDown('slow');
});
});
</script>
<?=$this->translate('Add images')?>
<form action="" method="post" enctype="multipart/form-data">
<div id="upload_list">
<input type="file" name="image[]" /><br />
<input type="file" name="image[]" /><br />
<input type="file" name="image[]" /><br />
</div>
<a href="#" id="upload_more"><?=$this->translate('Upload another image')?></a><br />
<input type="submit" name="image_uploade" value="<?=$this->translate('Upload images')?>" />
</form>
但我是我無法找出如何我可以創建這樣的事情與Zend_From,我想用Zend_Form這個thoug的唯一理由是爲uploadet文件的驗證。
$element = new Zend_Form_Element_File('image');
$element->setRequired(true)
->setLabel('Profile image')
->setDestination($store)
->setValueDisabled(true)
->addValidator(new Zend_Validate_File_ImageSize(array(
'minheight' => 100, 'minwidth' => 150,
'maxheight' => 1920, 'maxwidth' => 1200)))
// File must be below 1.5 Mb
->addValidator(new Zend_Validate_File_FilesSize(array('max' => 1572864)))
->addValidator(new Zend_Validate_File_IsImage());
如果任何1可以幫我處理這件事了,我將是巨大的檸全:d
謝謝你,這只是我一直在尋找的是:d – Androme 2010-04-10 14:27:01
http://framework.zend.com/manual/en/zend.form.standardElements的.html#zend.form.standardElements.file – Ballsacian1 2010-04-10 15:21:48