0

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

1 回答 1

0

我认为您缺少标签enctype="multipart/form-data"上的属性。form否则,表单默认提交enctypeapplication/x-www-form-urlencoded不支持二进制数据上传。

于 2012-11-07T08:19:23.903 回答