|
function fileUpvideo(){
$config['upload_path'] = './upload';
$config['allowed_types'] = '*';//文件类型
$config['max_size'] = '0';
$config['encrypt_name'] = true;
$this->load->library('upload',$config);
$this->upload->initialize($config);
if ($this->upload->do_upload('video_src')) {
$upload_data = $this->upload->data();
return $config['upload_path'].'/'.$upload_data['file_name'];
}
else
{
$error = array('error' => $this->upload->display_errors());
print_r($error) ;
}
}
////////////////////////////////////////////////////////////////////
<dl>
<dt>视频上传</dt>
<dd>
<?php
$attr = array('class' =>'input normal upload-path', );
echo form_upload('video_src','',$attr)
?>
</dd>
</dl>
////////////////////////////////////////////////////////
mimes.php里已添加
'mp4' => 'application/octet-stream',
////////////////////////////////////////////////////////
选择上传rar 图片能成功上传 但是上传MP4 就会出现错误
Array ( [error] =>
You did not select a file to upload.
新手求解啊 |
|