由于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.";
}
?>