Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Linking Image to database collection record for retrieval and display purposes

Hi

I have learnt to upload an image to the File Collection through your tutorial.

I now nee to link that image to a record in the database collection.

This is what I have done:

In the upload.js file from your tutorial I changed the following line......

// localStorage.setItem('db_file_name', file.name);
to
localStorage.setData('db_file_url', data.fileurl);

I added a local storage variable named db_file_url

I then mapped my response data entry fields to my collection and also including the local storage variable I mapped to a col in my collection.

I have a page to capture all the information for the collection with a submit.

When I click my submit button, the image url is not captured to the database, however alll the data I entered is populated to the database collection.

Do you have a tutorial on this or can you assist me to accomplish this task?
I have seen another post but it does not make sense at all.

My app is shared with support Code Crossing BO
The page I am referring to is ProductDetail

Thank you.

Anton Artyukh5836028
Posts: 0
Joined: Wed May 08, 2013 12:57 pm

Linking Image to database collection record for retrieval and display purposes

Hello,

There is no method localStorage.setData/b; You need localStorage.setItem/b;.

And next, You can replace your Done button by code
coderestservice1.execute({});/code
placed after codelocalStorage.setItem('db_file_url', data.fileurl);/code

So, your code for success uploading can looks like this:
code// OPTIONAL, this is the file name under which the image was stored in database....
localStorage.setItem('db_file_url', data.fileurl);
restservice1.execute({});/code

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Linking Image to database collection record for retrieval and display purposes

Awesome, thank you.

FYI.

localStorage.setData();

was copied from this post https://getsatisfaction.com/apperyio/...

Return to “Issues”