写真を接続してサーバーにアップロードしようとしています..これのコルドバ1.7.0の例はありません..これを試してみるだけですが、うまくいきません。私のエラーは.. wait_fences: 応答を受信できませんでした: 10004003.
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
destinationType: destinationType.DATA_URL });
}
// A button will call this function
//
function getPhoto(source) {
// Retrieve image file location from specified source
navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,
destinationType: destinationType.FILE_URI,
sourceType: source });
}
function onSuccess(imageData) {
var image = document.getElementById('myImage');
image.src = "data:image/jpeg;base64," + imageData;
$.post('http://site.com/api/upload.php', {data:imageData});
}
<?php
if ($_REQUEST['image']) {
// convert the image data from base64
$imgData = base64_decode($_REQUEST['image']);
// set the image paths
$file = '/api/' . md5(date('Ymdgisu')) . '.jpg';
$url = 'http://www.site.com' . $file;
// delete the image if it already exists
if (file_exists($file)) { unlink($file); }
// write the imgData to the file
$fp = fopen($file, 'w');
fwrite($fp, $imgData);
fclose($fp);
}
?>