【发布时间】:2014-05-16 15:49:30
【问题描述】:
我正在使用 Miles Johnson file Uploader 和我的 CakePHP。每次对我来说都很好。但是今天我想以我的观点使用jQuery Form Plugin,但它无法捕获必需验证。没有jQuery Form Plugin 它工作正常。我的 jQuery 代码如下:
jQuery('#ImageAddForm').ajaxForm({
iframe:false,
beforeSend: function() {},
uploadProgress: function(event, position, total, percentComplete) {},
success: function() {},
complete: function(xhr) {}
});
还有模型验证代码如下:
public $actsAs = array(
'Uploader.Attachment' => array(
'imagefile' => array(
'finalPath'=>'/files/uploads/'
)
),
'Uploader.FileValidation' => array(
'imagefile' => array(
'extension' => array('pdf','zip'),
'mimeType' => array('application/pdf','application/zip'),
'filesize' => array(
'value'=>104857600,
'error'=>'Your file size is too large; maximum size 100 MB'
),
'required' => array(
'value' => true,
'on' => 'create',
'error' => 'Please choose iPad Portrait file',
)
)
)
);
如有任何建议,我将不胜感激。
【问题讨论】:
-
it could not catch required validation到底是什么意思? -
@FazalRasel 如果我不选择任何文件,它不会显示错误
标签: jquery validation cakephp file-upload jquery-plugins