duanjucong3124 2016-09-07 13:21 采纳率: 100%
浏览 70
已采纳

php base64 iphone图片到webservice

i need your help please and i haven't found some answers for my problem.

I want to take a picture (or take it from the gallery) on the iphone/ipad and then encode the picture to a base64 string with php and send the base64 string to a webservice.

If i try it on the pc, everything is alright. if i want to do this on the ipad, it seems like nothing or a incorrect base64 string is send to the webservice but i have no idea why or so?!

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);
}

function 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;
   }
}

Any Ideas why this didn't work on ipad/iphone?

i hope anybody could help me.

  • 写回答

2条回答 默认 最新

  • dongzouqie4220 2016-09-07 15:02
    关注

    SOLVED

    The Problem is that the SOAP Service had a Max-Size for the Files for 1MB! That was the Problem why i can't upload Base64 Strings who are bigger than 1MB!

    Now we increase the Max-Size for Files to 10MB and now it works!

    And that was the reason why i cant upload some pictures because some pictures was bigger than 1mb in the base64 string.

    Thx for help to everybody!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料