Page 1 of 1

Cant link a file column to file in files collection

Posted: Wed Jul 22, 2015 2:32 am
by Asif Ansari

Hello, I am able to successfully upload an image to the database using the tutorials given. The issue is when I want to link that image to the user profile. The structure I have starts with the users collection that has a pointer to a Customers collection. The customers collection has a column of type file which I am expecting to store the main profile pic to. I can manually update that column to point to the file I just uploaded to the files collection, but I don't know how to do this programmatically. I have gone through all the tutorials and can't find out how to do this. On success of the file upload, the response returns a filename and originalfilename, but when trying to map that to a variable, it fails and doesn't continue to process further commands. Any help is much appreciated.


Cant link a file column to file in files collection

Posted: Wed Jul 22, 2015 5:45 pm
by Evgene Karachevtsev

Hello Asif,

Please check this post, hope it will be useful for you:
https://getsatisfaction.com/apperyio/...


Cant link a file column to file in files collection

Posted: Wed Jul 22, 2015 8:58 pm
by Asif Ansari

Evgene,

Thanks, this actually did help and I was able to store a string representation of the image base 64 in the collection. Do you have any information on how to actually store something with a column of type file???


Cant link a file column to file in files collection

Posted: Sun Jul 26, 2015 1:38 pm
by Alena Prykhodko

Dear Asif,

Please read this brief explanation https://devcenter.appery.io/documenta...


Cant link a file column to file in files collection

Posted: Sun Jul 26, 2015 4:06 pm
by Asif Ansari

Alena, thanks I appreciate it, I have seen this link numerous times. I know how to store the file using the media manager through the interface you have available. I am more interested in learning how I do it programattically. Do you have an example where the user loads a specific file to the media manager, and then that file is referenced back to the file column of a different collection?


Cant link a file column to file in files collection

Posted: Mon Jul 27, 2015 2:49 am
by Yurii Orishchuk

Hi Asif,

Here is a common plan to upload file and store it in "file" type collection field.

1 Upload file and fetch "fileName" value from it response. Store it in some storage.
2 In update/create service you need to link value from storage(1st step) to file-field "fileName" request parameter.
Details: http://prntscr.com/7xekdv/direct

So basically you need to pass received from upload service fileName to fileName request parameter in update service.

Regards.


Cant link a file column to file in files collection

Posted: Mon Jul 27, 2015 4:59 pm
by Asif Ansari

Thanks Yurii, we're getting closer. The problem is when I upload an image to the file collection following this tutorial... https://devcenter.appery.io/tutorials... . It does not return a filename to me anywhere. Do you have steps to show me how I use the service with the mapping so it returns the filename? Thanks.


Cant link a file column to file in files collection

Posted: Thu Jul 30, 2015 4:36 am
by Yurii Orishchuk

Hi Asif,

Yes if you use this "upload" service - your service responds with these parameters.

Please check upload service if you don't have such parameters you need add them manually.

Details: http://prntscr.com/7yl3xv/direct

Regards.


Cant link a file column to file in files collection

Posted: Fri Jul 31, 2015 2:04 am
by Asif Ansari

Yurii, thank you so much for this reply. I see where the problem was. It was in the creation of the upload service that is created automatically. The response body was not in the same format as in your screenshot. Once I changed it, I started seeing the results. It looks like you may have a bug in the service creation and how the response is generated. Thanks again.