Support Topics Documentation Slack YouTube Blog

How to declare relation with file?


(Saad Zahoor) #1

I have a login-register business app I want to declare relation of the file with the table? If anyone points me to the right direction I really appreciate. Thanks


(Vladimir Upirov) #2

Hi Saad
Go to Data Service -> select table -> open Schema Section -> click “new” -> and select “File Reference”

Is it what you are looking for?

Regards, Vlad!


(Saad Zahoor) #3

Thank you for your time

yes i did it through console but i want to do it through api


(Mark Piller) #4

If the column is not declared manually in the table, there is no way to instruct backendless to create it specifically as File Reference column using the API. The recommended approach is to create the column as @vladimir-upirov showed above and then use String data type for the file URL in your code.


(Saad Zahoor) #5

yes, I have declared it manually! Now I do not know what should I do? Which Api should i use?

Capture


(Mark Piller) #6

What do you want to get done?


(Vladimir Upirov) #7

Just use “save/update” api

Backendless.Data.of( "TABLE-NAME" ).save( { propertyA:"", propertyB:""} )

it works the same way as for String column,

as value set url to the file


(Saad Zahoor) #8

under userProfilePicture column i want the pointer that direct or show the user profile picture. if I did it through console it’s easy, i am looking for the how can I get it through API

this is what I need using API


(Mark Piller) #9

When you retrieve that object from the database, the userProfilePicture property will contain the URL for the picture. So you need to do something in the code to display that picture.


(Saad Zahoor) #10

ok i get it now … Thanks . i will give it a try