- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi team,
I am working on a project in which I need to upload an image to a server using XDK code as shown below.
intel.xdk.file.uploadToServer(pictureURL,"http://www.myserver.com/uploadImage.php", "", "image/jpeg", "updateUploadProgress");
I have two issues:
1. The callback gives a success yet the upload does not even reach the server URL, what could be failing?
2. Is there a way of adding more parameters to describe the upload?
Please assist, thanks.
- Tags:
- HTML5
- Intel® XDK
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Do you have the appropriate permissions on the folder you are trying to upload to?
2. No.
It will not work in the XDK you have to build and test it on device.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi John,
Thanks for the quick reply,
1. Yes, I have given all the appropriate permissions infact ive given all permissions 777. What else could I be doing wrong? Please see my code snippet below:
<script> function captureCamera() { intel.xdk.camera.takePicture(10,true,"png"); } function importLibrary() { intel.xdk.camera.importPicture(); } document.addEventListener("intel.xdk.camera.picture.add",function(event){ var name = event.filename; var url = intel.xdk.camera.getPictureURL(name); document.getElementById("picture").setAttribute("src", url); alert(url); intel.xdk.file.uploadToServer(url,"http://wiseapp.mobi/apphour/index.php", "name", "image/png", "updateUploadProgress"); alert("Request sent"); }); document.addEventListener("intel.xdk.camera.picture.busy",function(){ alert("Camera is already in use"); }); document.addEventListener("intel.xdk.camera.picture.cancel",function(){ alert("You pressed the cancel button"); }); function updateUploadProgress(bytesSent,totalBytes) { if(totalBytes>0) currentProgress=(bytesSent/totalBytes)*100; document.getElementById("progress").setAttribute("value", currentProgress); } document.addEventListener("intel.xdk.file.upload.busy",uploadBusy); document.addEventListener("intel.xdk.file.upload",uploadComplete); document.addEventListener("intel.xdk.file.upload.cancel",uploadCancelled); function uploadBusy(evt) { alert("Sorry, a file is already being uploaded"); } function uploadComplete(evt) { if(evt.success==true) { alert("Image was uploaded"); } else { alert("Error uploading file "+evt.message); } } function uploadCancelled(evt) { alert("File upload was cancelled "+evt.localURL); } </script>
2. Ok, thanks anyway.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page