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条)

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改