- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello friend,
How to upload image to server. i used intel xdk and cordova plugin used.and also used file transfer plugin. i upload image on my android phone ,but image can not upload to server.
below code:
<html>
<head>
<script>
function getImage() {
navigator.camera.getPicture(uploadPhoto, function(message) {
alert('get picture failed');
}, {
quality: 100,
destinationType: navigator.camera.DestinationType.FILE_URI,
sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
});
}
function uploadPhoto(imageURI) {
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1);
options.mimeType = "image/jpeg";
console.log(options.fileName);
var params = new Object();
params.value1 = "test";
params.value2 = "param";
options.params = params;
options.chunkedMode = false;
var ft = new FileTransfer();
console.log(imageURI);
alert(imageURI);
ft.upload(imageURI, "http://servername/upload.php", function(result){
console.log(JSON.stringify(result));
}, function(error){
console.log(JSON.stringify(error));
}, options);
}
</script>
</head>
<body>
<button onclick="getImage()">Upload a Photo</button>
</body>
</html>
- Tags:
- HTML5
- Intel® XDK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
kishan k. wrote:
i search my question on google,but google can not find any solution,so please give me for your suggestion
From the Google search that was provided, there are several good articles to use as a reference:
- https://phonegappro.com/tutorials/upload-images-to-server-using-phonegap-file-transfer-plugin/
- http://zacvineyard.com/blog/2011/03/upload-a-file-to-a-remote-server-with-phonegap
- https://www.tutorialspoint.com/cordova/cordova_file_transfer.htm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
kishan k. wrote:
i follow tutorialspoint for file transfer,but this example can not work on my android phone, i am used intel xdk tools,and i put file transfer code on this tools,but it is not working ,so please you write code .
I'm sorry, but we do not have the resources to help you write your Cordova HTML5 application or debug your program issues. We are providing you with the tools to build and debug your app, but we are not able to provide personal debug services. I recommend you search the Internet for solutions to your problem, there are many blogs and posts on Stack Overflow covering how to write Cordova and PhoneGap apps. The Intel XDK creates a standard Cordova application, so solutions for Cordova and PhoneGap will apply to an application written to be built with the Intel XDK.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page