我正在尝试上传服务器文件夹中的wmv文件并在数据库中命名,我希望以秒为单位显示该文件的长度。
<audio id="myaudio" controls>
<source src="res->voice_path" type="audio/wmv">
<source src="res->voice_path" type="audio/ogg">
Your browser does not support the audio element.
</audio>
<script>
var vid = document.getElementById("myaudio");
function myFunction() {
alert(vid.duration);
}
</script>
在这里,我可以在警告框中获取音频长度,但我需要回应如何将该值转换为变量并在CodeIgniter中回显。
我在视图中使用的上述代码。
答案 0 :(得分:-1)
$this->load->model('songshare/Songmodel');
$this->Songmodel->songupload($data);
//upload data
$config['upload_path'] = realpath(APPPATH.'../uploads/');
$config['max_size'] = '0';
$config['allowed_types'] = 'mp3|wav';
$this->load->library('upload', $config);
if (!$this->upload->do_upload('userfile')) {
$data = array('msg' => $this->upload->display_errors());
} else { //else, set the success message
$data = array('upload_data' => $this->upload->data());
$field = 'userfile';
var_dump($_FILES[$field]['type']);
}