当我尝试该应用程序时,一切正常。出现成功日志。但是当我签入服务器时,没有照片。
这是我的代码。
脚本.js
$('#gallery_page').live('pageshow', function(){
getGallery();
$('#library').bind('click', function(){
photo_library();
getGallery();
});
});
function photo_library(source) {
var pictureSource; // picture source
var destinationType; // sets the format of returned value
document.addEventListener("deviceready",onDeviceReady,false);
function onDeviceReady() {
pictureSource=navigator.camera.PictureSourceType;
destinationType=navigator.camera.DestinationType;
};
navigator.camera.getPicture( uploadPhoto, onFail, { quality: 50,
destinationType: destinationType.FILE_URI,
sourceType: pictureSource.PHOTOLIBRARY });
};
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey="file";
options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1);
options.mimeType="image/jpeg";
options.chunkedMode = false;
var ft = new FileTransfer();
ft.upload(imageURI, "http://*my_ip*/TA/php/upload.php", win, fail, options, true);
};
上传.php
include 'db.php';
print_r($_FILES);
$new_image_name = "namethisimage.jpg";
move_uploaded_file($_FILES["file"]["tmp_name"], "http://*my_ip*/TA/php/".$new_image_name);