John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

How do i set up my camera service to send the pictures to my server?

Im trying to figure out how to send the pics the user just took with the phone to send them to my server? I also mapped to local storage the asset value of the image that i also mapped to display on the screen.

I thought maybe I create a REST service to map to the local storage variable i saved the pic in and send it as a request parameter, but when Im setting up the REST service I'm looking for a multi-part/form - content type. The only options there are:

1) json
2) xml OR
3) x-www-forum-urlencoded

which one of those options would it be?

OR, do I do i create another camera service, and if so, I cant edit any request parameters so how would add map the image asset?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How do i set up my camera service to send the pictures to my server?

The Camera service (based on PhoneGap) only takes an image, it doesn't upload it. You can see how to upload here: https://getsatisfaction.com/apperyio/...

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

How do i set up my camera service to send the pictures to my server?

what are you saying? that I cannot return this pics to my own server, I have to use appery's database?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How do i set up my camera service to send the pictures to my server?

You can use any service and upload files/data to any service. That's the example that we have.

This is another example that uses JavaScript: http://docs.appery.io/tutorials/uploa.... You can update it to upload to your service.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

How do i set up my camera service to send the pictures to my server?

it seem to me that both of them tell you how to use Appery's database. How would I set up a REST service that I'm looking for a multi-part/form - content type??

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How do i set up my camera service to send the pictures to my server?

We don't know how your service works.. you can look at the examples I provided and adapt for your service. This is something you will need to code.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

How do i set up my camera service to send the pictures to my server?

uhmm, the only thing i found in there that might work, but not sure is running this JS:

var file;
function fileSelectHandler(e) {
var files = e.target.files || e.dataTransfer.files;
file = files[0];
previewFile();
}

function upload() {
var serverUrl = 'https://api.appery.io/rest/1/db/files/' + file.name;

Code: Select all

 $.ajax({ 
     type: "POST", 
     beforeSend: function(request) { 
         request.setRequestHeader("X-Appery-Database-Id", FileDB_settings['database_id']),              
         request.setRequestHeader("X-Appery-Session-Token", localStorage.getItem('token')), 
         request.setRequestHeader("Content-Type", file.type); 

     }, 
     url: serverUrl, 
     data: file, 
     processData: false, 
     contentType: false, 
     success: function(data) { 

         // OPTIONAL, this is the file name under which the image was stored in database.... 
         // localStorage.setItem('db_file_name', file.name); 

      }, 
     error: function(data) { 
         // do something in case of an error... 
     } 
 }); 

}

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

How do i set up my camera service to send the pictures to my server?

I'm assuming that I would change Appery's url's to my aws server??

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

How do i set up my camera service to send the pictures to my server?

also, If I have the files in localSTorage, then how would it affect the code?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How do i set up my camera service to send the pictures to my server?

As I said, I don't know how your service works. Yes, you would need to point the service URL to your server.

Return to “Issues”