我需要你的幫助,我還沒有找到我的問題的一些答案。php base64 iphone圖片到webservice
我想在iphone/ipad上拍一張照片(或從照片庫中取出),然後用php將圖片編碼爲base64字符串,然後將base64字符串發送到web服務。
如果我在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的工作嗎?
我希望有人能幫助我。
THX這一點,但我不解決這個問題:/ somtetimes我得到通知後,我將照片上傳 注意:試圖geht在非對象的proberty .... 74行,和線路74是if($ result-> return_value!=「ERROR」) 所以我認爲我發送了不正確的數據到web服務?或者base64不正確? – Mark
''pic_base64'在'savePicture'函數內看起來好嗎? –
是的,它在savePicture函數中看起來沒問題! 例如,我在savePicture中做了一個回聲,在我調用savePicture之後,這些字符串看起來像是一樣的......但我沒有檢查字符串中的任何字符。 – Mark