Page 1 of 1

Retrieve files from Non-File Collection

Posted: Mon Aug 18, 2014 5:25 am
by Alan Fernandez

How do you retrieve an image from a collection in the database, NOT THE FILE COLLECTION, and store it locally so that it can be displayed in an image component? Using just a request doesn't display the image, it shows a broken image link.

I've browsed the forum but found only how to do it with the file collection and a direct link to the item.

I'd like to not use the file collection to simplify the process of adding new entries to the database by the customer.


Retrieve files from Non-File Collection

Posted: Mon Aug 18, 2014 6:27 am
by Kateryna Grynko

Hi Alan,

You can store files only in Files collection. In other collections you can store only a file content.

Could you please clarify how you store file not in Files collection and how you request it?


Retrieve files from Non-File Collection

Posted: Mon Aug 18, 2014 6:45 pm
by Alan Fernandez

In the appery database there is a "File Collection" and you can create other collections yourself.

I created a collection and added a column called "Image" and its type: "File"
I would like to retrieve that file from that collection.

a href="http://s29.postImage
/a

So this is not possible?


Retrieve files from Non-File Collection

Posted: Tue Aug 19, 2014 1:35 am
by Yurii Orishchuk

Hi Alan,

You can use this custom collection to store images in.

But you need to store image in base64URL.

See details here:

http://en.wikipedia.org/wiki/Data_URI...

Here you can try to convert image to base64 format: http://websemantics.co.uk/online_tool...

Here you can find info how to read file from input(type=file) this base64 img.

https://developer.mozilla.org/en-US/d...

Regards.