我想在上传视频(*.flv 格式)时在我的应用程序中显示一个动态进度条。我在网上搜索了 2 个多小时,但找不到任何教程来指导我完成此过程。
到目前为止我所拥有的:
- 上传视频的脚本
- 本节中包含的 jQuery 库
但是接下来该怎么办?这是上传我使用的视频的控制器操作:
public function uploadPublicVideoAction()
{
$request = $this->getRequest();
$media = $this->_getTable('Media');
$form = $this->_getForm('UploadPublicVideo',
$this->_helper->url('upload-public-video'));
// if POST data has been submitted
if ($request->isPost()) {
// if the UploadPublicVideo form has been submitted and the submitted data is valid
if (isset($_POST['upload_public_video']) && $form->isValid($_POST)) {
$data = $form->getValues();
$data['user_id'] = $this->view->identity->id;
$ext = end(explode('.', $form->video->getFileName()));
$dbTrans = false;
try {
$db = $this->_getDb();
$dbTrans = $db->beginTransaction();
$data['type'] = 'video';
$data['status'] = 'public';
$paths = $media->add($data, $ext);
if (file_exists($paths[0])) {
unlink($paths[0]);
}
if (file_exists($paths[1])) {
unlink($paths[1]);
}
// add filter for renaming the uploaded photo
$form->video->addFilter('Rename',
array('target' => $paths[0],
'overwrite' => true));
// upload the video
$form->video->receive();
// create a thumbnail
//$this->_helper->FlvThumbnail($path[0], $path[1]);
$db->commit();
$form->reset();
$this->view->success = 'Public video successfully uploaded';
} catch (Exception $e) {
if (true === $dbTrans) {
$db->rollBack();
}
$this->view->error = $e->getMessage();
}
}
}
$this->view->headTitle('Upload Public Video');
$this->view->form = $form;
}
谁能告诉我一个简单的方法来结合使用 Zend_Progressbar 和 jQuery 来实现动态上传进度条?