php base64 iphone picture to webservice


php base64 iphone picture to webservice

我需要你的帮助,我的问题还没有找到答案。

我想在iphone/ipad上拍摄一张照片(或从图库中拍摄),然后用php将图片编码为base64字符串并将base64字符串发送给webservice。

如果我在pc上尝试,一切都是正确的。如果我想在ipad上这样做,似乎没有什么或一个不正确的base64字符串被发送到web服务,但我不知道为什么?!

picture.php

<form action="picture.php?action=upload" method="post" enctype="multipart/form-data">
<input type="file" name="datei" accept="capture=camcorder">
<br/><br/>
<input type="submit" value="up">
</form>
<?
if(isset($_GET['action']))
{
    $tmp_name = $_FILES["datei"]["tmp_name"];
    $name = $_FILES["datei"]["name"];
    $name = substr($name,0,-4);
    $name.="_".time().".jpg";
    move_uploaded_file($tmp_name, "upload/".$name);
    $content = file_get_contents ( "upload/".$name );
    $imageBase = base64_encode( $content );
    $success = savePicture($imageBase);
}

函数savePicture ()

function savePicture($pic_base64)
{
    ini_set("soap.wsdl_cache_enabled", "0");
    $pageURL = 'http://....';
    $page = new NTLMSoapClient($pageURL);
    $params = array("pRecordID" => "1",
                  "pFieldID" => 70000,
                  "pUserID" => "153",
                  "pContent" => $pic_base64
                  );
   $result = $page->SetBLOBValue($params);
   if($result->return_value != "ERROR")
   {
    return true;
   }
   else
   {
    return false;
   }
}

你知道为什么这不能在ipad/iphone上工作吗?

我希望有人能帮助我。

我认为iPhone/iPad在capture=camcorder上有一些问题。

Please try this:

<input type="file" name="datei" accept="image/*;capture=camera">

代替

<input type="file" name="datei" accept="capture=camcorder">

查看更多信息:

http://www.html5rocks.com/de/tutorials/getusermedia/intro/

SOLVED

问题是SOAP服务对文件的最大大小为1MB!这就是为什么我不能上传大于1MB的Base64字符串的问题!

现在我们将文件的最大大小增加到10MB,现在它工作了!

这就是为什么我不能上传一些图片的原因,因为有些图片在base64字符串中大于1mb。

谢谢大家的帮助!