无法上传音频文件到服务器
问题描述:
我有这个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手机设备)上传时,上传图像它的作品,但它不会让用户上传音频文件,当用户想要上传文件时,它只是给出以下选项:图像低于
当用户点击**时从文件上传表单中选择文件**这些选项只能上传,然后无法上传音频。 我该如何解决它。 谢谢。
答
我试图找出你的问题,我相信它是由于AAC保护,Apple Lossless和Audible文件,尝试不同的音频文件,因为有相当多的。只有少数支持。
继承人的支持列表:
- MP3
- MP4
- WAV
希望它帮助!
https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats –
我使用这些音频格式,但不让我仍然上传音频文件 – ako