Page 1 of 1

Using phone camera from web app

Posted: Fri Dec 06, 2013 11:20 am
by dibe84

Hi Guys, I just subscribe to Appery and it's simply AMAZING! Now I'm a little stuccoed with a think, maybe you could help me: I inserted in my start-app a html component with the following code:

Opening my web app with the phone browser it works fine and successfully opens the phone camera and, once i took the picture, I can see it on the page.
Now the question is: how can I access to the picture and save it to the Database? Which is the best approach for that? Using jQuery to navigate the HTML component or there's any more convenient way?

Thank you,
Gabriele


Using phone camera from web app

Posted: Fri Dec 06, 2013 11:43 am
by Maryna Brodina

Hello! Could you post code you use? For posting code use < code tag.


Using phone camera from web app

Posted: Fri Dec 06, 2013 12:09 pm
by dibe84

Sorry, I didn't notice the code was not there:

code
<form><input type="file" accept="image&#47;*" &#47;><&#47;form>
/code


Using phone camera from web app

Posted: Fri Dec 06, 2013 1:41 pm
by Maryna Brodina

Using phone camera from web app

Posted: Sun Dec 08, 2013 2:48 pm
by dibe84

Thank you very much Maryna! I finally had time to follow the suggested tutorial (the first one, because I'm only interested in a web app for now) and it works great: now I'm able to take the picture and save it into the file DB, in the same time i'm saving the image name (unique id) into a collection in order to be able to query it.

Now i'm trying to show an image into the picture component following those steps:

  • "http://docs.appery.io/tutorials/uploa..." - Viewing the uploaded file
    (also "http://docs.appery.io/documentation/b..." - Retrieving Files)

    For now i'm trying with an "static" image name that I hardcoded into the request URL (as into the example) but i'm not able to let it work: when I try to TEST the request I constantly see "Sending request. Please wait..." and it never ends :(

    Request Details:
    Settings:
    URL: {database_url}/rest/1/db/files/0566c9fa-4bfc-4afa-9afc-bd7d083ad471.VLC_icon.png111
    Method: get
    Data Type: json
    Settings: None (also tried with FileDB_settings...)
    Security: None
    Request:
    X-Appery-Database-Id: {database_id} [header]
    X-Appery-Session-Token: xxxxx (value taken from the response of the Login service) [header]
    encoded: base64
    Response:
    base64data

    If I try to send the request when i load the page a receive two types of errors:

  • If I specify "FileDB_settings" into the setting of the request I receive (chrome console):

    Request URL:https://api.appery.io/rest/1/db/rest/...
    Request Method:GET
    Status Code:405 Method Not Allowed
    Request Headersview source

  • If i don't specify it, I receive (chrome console):

    Request URL:http://appery.io/rest/1/db/files/0566...
    Request Method:GET
    Status Code:302 Found

    but after then a generale "Parse Error"

    I don't understand what I'm doing wrong... and also why the service TEST always get stucked with this specified request.

    Thanks a lot for the attention.

    Gabriele


Using phone camera from web app

Posted: Sun Dec 08, 2013 3:18 pm
by dibe84

I solved! problem was that in "{database_url}" i specified the wrong values, basically I was setting the url path twice!!

:)