Page 1 of 2

Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 7:52 pm
by Jason Carmen

How do you set the response of an API ImageUpload Post to the Asset property of an Image when using the HTML File Upload to post to the external API?


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 8:49 pm
by Maryna Brodina

Hello!
Could you clarify where do you post and what you have in response from service?


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 8:51 pm
by Jason Carmen

Hi Posting to this url:
http://www.fangatez.com/api/ImageUpload

Response: http://www.fangatez.com/IMAGES/page2-...

I want to be able to post to that url an uploaded image and then set the Asset Porperty on the image control to the posted response


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 9:09 pm
by Jason Carmen

Hi Posting to this url:
http://www.fangatez.com/api/ImageUpload

Response: http://www.fangatez.com/IMAGES/page2-...

I want to be able to post to that url an uploaded image and then set the Asset Porperty on the image control to the posted response


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 9:49 pm
by Maryna Brodina

There is only image URL in response. It's not json or xml. In this case mapping won't work. On service complete event you have to set image asset preAppery("imgName").attr("src", jqXHR.responseText);/pre


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 9:52 pm
by Jason Carmen

The thing is in order to upload an image you have to use the html control you have no context on the post from the form. Do I need to create some kind of reponse type in my post method?


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 10:02 pm
by Maryna Brodina

Yes, in response you can send json. This way you'll be able to use mapping from response to image asset.


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 10:08 pm
by Jason Carmen

That does not help me with uploading the image in the first place. How do I upload the image?


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Fri Mar 07, 2014 10:15 pm
by Jason Carmen

To be more clear I guess what I am saying is that I am trying to allow a user to upload an image I want to take the image they upload post it to my api url and then map the response to a local variable so that I use it later on another screen I have modifed the api repsone to retrun some Json data points


Mapping ImageUpload Response Content to Image control from HTML control post

Posted: Sun Mar 09, 2014 11:04 pm
by Illya Stepanov

Hi Jason,

Please try to walk through this tutorial: http://docs.appery.io/tutorials/uploa...

This is an example of simple application that described in details how to upload the files (including the image).

If you still have problems after passing this tutorial, please post screen shots of your critical application parts.