由于 iOS6 现在支持照片/视频上传,我想在我的移动应用程序中使用它。在上传脚本提供的指定文件夹中没有上传照片或视频时会出现问题。不知道我做错了什么。
这是我用来抓取文件或捕获文件的内容......
<form action="" method="POST">
<input type="file" accept="image/* capture="camera"><br><br>
<input type="submit" value="Upload" class="login-button"/>
</form>
这会处理同一页面上的照片...
<?php
function findexts ($filename)
{
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
$ext = findexts ($_FILES['uploaded']['name']) ;
$ran = rand () ;
$ran2 = $ran.".";
$target = "files/";
$target = $target . $ran2.$ext;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file has been uploaded as ".$ran2.$ext;
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
?>