$(document).ready(
function(){
$("#Filedata").uploadify({
'uploader' : '/js/jquery/uploadify/uploadify.swf',
'cancelImg' : '/js/jquery/uploadify/cancel.png',
'queueID' : 'queue',
'multi' : true,
'script' : '/file.upload.do',
'auto' : true,
'fileExt' : '*.jpg;*.gif;*.png;*.bmp',
'fileDesc' : 'Image Files (.JPG, .GIF, .PNG, .BMP)',
'onError' : function(event, ID, fileObj, errorObj){
alert(errorObj.type + ' Error: ' + errorObj.info);
},
'onComplete' : function(event, queueID, fileObj, response, data){
if(response != 'OK') alert(response);
}
#response: message returns from server side script
});
}
);
album-photos/uploadError.phtml:
<?=message?>
uploadify's php script:
public function fileUploadDoAction(){
$this->_helper->layout()->disableLayout();
try{
#move tmp file codes
$this->view->message = 'OK';
}catch(Exception $e){
$this->view->message = $e->getMessage();
}
$this->renderScript('album-photos/uploadError.phtml');
}
沒有留言:
張貼留言