uploadify上传视频无法保存到数据表里的问题
求教:这样子视频文件是可以上传到\Uploads\Picture\目录了,但是video这个字段怎么存不到数据库里呢?
想跟踪,但是不知道要在哪里设置跟踪代码,数据写入代码在哪里呢?请不吝赐教!
想跟踪,但是不知道要在哪里设置跟踪代码,数据写入代码在哪里呢?请不吝赐教!

<div class="form-item">
<label class="item-label">视频</label>
<div class="controls">
<input type="file" id="upload_video">
<input type="hidden" name="video" id="vid" value="{$people.video}"/>
<div class="upload-video-box">
<notempty name="people.video">
<div class="upload-pre-item">
<video width="602px" height="345px" controls="controls">
<source src="__ROOT__/{$people.video}" type="video/mp4"></source>
</video>
</div>
</notempty>
</div>
</div>
</div>
//上传视频
/* 初始化上传插件 */
$("#upload_video").uploadify({
"height" : 400,
"swf" : "__STATIC__/uploadify/uploadify.swf",
"fileObjName" : "download",
"buttonText" : "上传视频",
"uploader" : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
"width" : 600,
'removeTimeout' : 1,
'fileTypeExts' : '*.avi; *.rmvb; *.rm; *.asf; *.divx; *.mpg; *.mpeg; *.mpe; *.wmv; *.mp4; *.mkv; *.vob; *.gif;',
'fileSizeLimit' : '1024M',
"onUploadSuccess" : uploadVideoFrontvideo,
'onFallback' : function() {
alert('未检测到兼容版本的Flash.');
},
'onUploadSuccess' : function(file, data, response) {
//alert(file.name + ' | ' + response + ':' + data);
},
'onUploadError' : function(file, errorCode, errorMsg, errorString) {
alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
}
});
function uploadVideoFrontvideo(file, data){
var data = $.parseJSON(data);
var src = '';
if(data.status){
$("#vid").val(data.path);
src = data.url || '__ROOT__' + data.path
$("#vid").parent().find('.upload-video-box').html(
'<div class="upload-pre-item"><video width="602px" height="345px" controls="controls"><source src="' + src + '" type="video/mp4"></source></video></div>'
);
} else {
updateAlert(data.info);
setTimeout(function(){
$('#top-alert').find('button').click();
$(that).removeMatch_type('disabled').prop('disabled',false);
},1500);
}
}
use Think\Upload;
...
//====================================富文本框===========================
/* 上传图片 */
public function upload() {
/* 上传配置 */
$setting = C ( 'EDITOR_UPLOAD' );
$setting ['callback'] = array (
$this
);
/* 调用文件上传组件上传文件 */
$this->uploader = new Upload ( $setting, 'Local' );
$info = $this->uploader->upload ( $_FILES );
// dump($info);
if ($info) {
$dao = D ( 'Picture', 'Home' );
foreach ( $info as &$file ) {
$file ['rootpath'] = __ROOT__ . ltrim ( $setting ['rootPath'], "." );
/* 已经存在文件记录 */
if (isset ( $file ['id'] ) && is_numeric ( $file ['id'] )) {
$file ['path'] = __ROOT__ . ltrim ( $file ['path'], "." );
continue;
}
/* 记录文件信息 */
$file ['path'] = __ROOT__ . ltrim ( $setting ['rootPath'], "." ) . $file ['savepath'] . $file ['savename'];
$file ['status'] = 1;
$file ['create_time'] = NOW_TIME;
if ($dao->create ( $file ) && ($id = $dao->add ())) {
$file ['id'] = $id;
}
}
}
return $info;
}
// keditor编辑器上传图片处理
public function ke_upimg() {
/* 返回标准数据 */
$return = array (
'error' => 0,
'info' => '上传成功',
'data' => ''
);
$info = $this->upload();
$img = $info ['imgFile'] ['path'];
/* 记录附件信息 */
if ($img) {
$return ['id'] = $info ['imgFile'] ['id'];
$return ['url'] = $img;
unset ( $return ['info'], $return ['data'] );
} else {
$return ['error'] = 1;
$return ['message'] = $this->uploader->getError ();
}
/* 返回JSON数据 */
exit ( json_encode ( $return ) );
}
/* 上传视频 */
public function upload_v() {
// 上传配置
$setting = C ( 'EDITOR_UPLOAD' );
$setting ['callback'] = array (
$this
);
// 调用文件上传组件上传文件
$this->uploader = new Upload ( $setting, 'Local' );
$info = $this->uploader->upload ( $_FILES );
dump($info);
if ($info) {
$dao = D ( 'Picture', 'Home' );
foreach ( $info as &$file ) {
$file ['rootpath'] = __ROOT__ . ltrim ( $setting ['rootPath'], "." );
// 已经存在文件记录
if (isset ( $file ['id'] ) && is_numeric ( $file ['id'] )) {
$file ['path'] = __ROOT__ . ltrim ( $file ['path'], "." );
continue;
}
// 记录文件信息
$file ['path'] = __ROOT__ . ltrim ( $setting ['rootPath'], "." ) . $file ['savepath'] . $file ['savename'];
$file ['status'] = 1;
$file ['create_time'] = NOW_TIME;
if ($dao->create ( $file ) && ($id = $dao->add ())) {
$file ['id'] = $id;
}
}
}
return $info;
}
// keditor编辑器上传视频处理
public function ke_upvideo() { // 没用到
/* 返回标准数据 */
$return = array (
'error' => 0,
'info' => '上传成功',
'data' => ''
);
$info = $this->upload_v();
$video = $info ['videoFile'] ['path'];
/* 记录附件信息 */
if ($video) {
$return ['id'] = $info ['videoFile'] ['id'];
$return ['url'] = $video;
unset ( $return ['info'], $return ['data'] );
} else {
$return ['error'] = 1;
$return ['message'] = $this->uploader->getError ();
}
/* 返回JSON数据 */
exit ( json_encode ( $return ) );
}
...全文
相关推荐
c# Uploadify 视频上传
在标题"Uploadify-v2.1.4和c#的结合上传视频"中,提到的是将Uploadify v2.1.4版本与C#服务器端代码集成,用于处理视频文件的上传。
swfupload上传并转码视频和jquery.uploadify的aspnet例子
**创建服务器端接收接口**:在ASP.NET项目中创建一个处理文件上传的控制器或Web服务方法,接收上传的文件并保存到服务器。4.
uploadify支持一次选择多个文件且批量上传
此外,还有错误处理(`onError`事件)、成功上传后的回调(`onUploadSuccess`事件)等机制,使得整个上传过程更加可控和灵活。在使用uploadify时,开发者需要注意兼容性问题。
uploadify-h5上传插件
Uploadify-H5上传插件是一款专门针对Web上传需求设计的工具,它旨在解决传统Uploadify插件对Flash的依赖问题。
uploadify 批量上传大文件
更重要的是,Uploadify支持大文件上传,经过测试,它可以处理超过3GB的文件,这在很多情况下都是非常必要的,比如上传高清视频、大型数据集或其他大型文档。


基础编程
