我有这个 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 Protected、Apple Lossless 和 Audible 文件,尝试不同的音频文件,因为有很多。并且只有少数受支持。
这是支持的列表:
- MP3
- MP4
- 音频
希望对您有所帮助!
关于php - 无法使用来自 IOS 设备的 PHP 脚本将音频文件上传到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38599361/