1.通知移动端,将文件放入指定的名称中,例如图片放在img,语音文件放在audio,视频文件放 在video中。
2.图片上传PHP接收代码:
if(!empty($_FILES[‘Img‘][‘tmp_name‘])){ $nameInfo = explode(‘.‘, $_FILES[‘Img‘][‘name‘]); $TempName = ‘IMG‘.$UserId.time(); $filename = $TempName.‘_400.‘.$nameInfo[1]; $file = $ImgPath.‘/‘.$filename; @move_uploaded_file($_FILES[‘Img‘][‘tmp_name‘],$file); }
3.视频上传:
$nameInfo = explode(‘.‘, $_FILES[‘Video‘][‘name‘]); $filename = ‘VIDEO‘.$UserId.time().‘.‘.$nameInfo[1]; $file = $VideoPath.‘/‘.$filename; @move_uploaded_file( $_FILES[‘Video‘][‘tmp_name‘], $file);
4.音频上传:
$nameInfo = explode(‘.‘, $_FILES[‘Audio‘][‘name‘]); $filename = ‘Audio‘.$this->userID.time().‘.‘.$nameInfo[1]; $file = $this->AudioPath.‘/‘.$filename; @move_uploaded_file( $_FILES[‘Audio‘][‘tmp_name‘], $file);
原文地址:http://9625815.blog.51cto.com/9615815/1665971