2016-07-26 85 views
2

我有這個PHP腳本將圖像或音頻文件上傳到服務器無法上傳音頻文件到服務器

<?php 
include "config.php"; 

function GetImageExtension($imagetype) 
{ 
    if(empty($imagetype)) return false; 
    switch($imagetype) 
    { 
     case 'image/bmp': return '.bmp'; 
     case 'image/gif': return '.gif'; 
     case 'image/jpeg': return '.jpg'; 
     case 'image/png': return '.png'; 
     case 'audio/mp3' : return '.mp3'; 
     case 'audio/mp4' : return '.mp4'; 
     case 'audio/wav' : return '.wav'; 
     default: return false; 
    } 
} 

if (!empty($_FILES["uploadedimage"]["name"])) 
{ 
    $file_name=$_FILES["uploadedimage"]["name"]; 
    $temp_name=$_FILES["uploadedimage"]["tmp_name"]; 
    $imgtype=$_FILES["uploadedimage"]["type"]; 
    $ext= GetImageExtension($imgtype); 
    if($ext!=false) 
    { 
      $imagename=date("d-m-Y")."-".time().$ext; 
      $target_path = "img/personal/".$imagename; 
     if(move_uploaded_file($temp_name, $target_path)) 
     { 
      $query_upload="INSERT INTO `images_tbl` (`image_id` ,`image_path` ,`subission_date`) 
      VALUES (NULL , '".$target_path."', CURRENT_TIMESTAMP)"; 
      mysql_query($query_upload) or die("error in $query_upload == ----> ".mysql_error()); 
      header("location:room.php"); 
     } 
     else 
      { 
       exit("Error While uploading image on the server"); 
      } 
    } 

} 
header("location:room.php"); 
?> 

上傳從Windows中的文件時,它的工作好操作系統,但從iOS(iPhone 6手機設備)上傳時,上傳圖像它的作品,但它不會讓用戶上傳音頻文件,當用戶想要上傳文件時,它只是給出以下選項:圖像低於 enter image description here

當用戶點擊**時從文件上傳表單中選擇文件**這些選項只能上傳,然後無法上傳音頻。 我該如何解決它。 謝謝。

回答

0

我試圖找出你的問題,我相信它是由於AAC保護,Apple Lossless和Audible文件,嘗試不同的音頻文件,因爲有相當多的。只有少數支持。

繼承人的支持列表:

  • MP3
  • MP4
  • WAV

希望它幫助!

+0

https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats –

+0

我使用這些音頻格式,但不讓我仍然上傳音頻文件 – ako

相關問題