Page 1 of 1

How to keep a link from a row inside a collection to a file

Posted: Mon Jun 16, 2014 3:55 pm
by Deep

Hi,
I have an app where for a row of information, there is a file (or more than one files). Now, in order to link a row to the file(s), I need to add a column to my collection. AFter uploading a file to the db, I need to put a unique name of this file (which is the appery generated name) in this column for that row. This will help me in reading where I can read the row, read the 'filename' column and then download the correspodning file.
So, how do I get the filename generated by the appery when upload completes? IS there response for upload?
Also, is there a way to rename the file?
What if the file names provided by the user are duplicated?


How to keep a link from a row inside a collection to a file

Posted: Mon Jun 16, 2014 7:01 pm
by Kateryna Grynko

Hi,

When creating a file, you specify a file name that will be stored in Database:precodecurl -X POST \
-H "X-Appery-Database-Id: 516fb7c3e4b0e0d8f16ccf9a" \
-H "X-Appery-Session-Token: <session_token>" \
-H "Content-Type: <content_type>" \
--data-binary '<file_content>' \
https:&#47;&#47;api&#46;appery&#46;io/rest/1/db/files/<file_name>/code/preFile name is generated from file ID and the original file name, for example 6fb9515d-82fd-43b3-9124-f0534dceca8eFILENAME. You'll get this ID after creating a file, in a service response. You can get the file itself by the same name:
http://devcenter.appery.io/documentat...
You won't be able to change it later.


How to keep a link from a row inside a collection to a file

Posted: Tue Jun 17, 2014 2:04 am
by Deep

Thanks!
I checked, there is no response defined for the standard file upload service. I tried adding a field 'File Name' to the service response, did not work either. Am I missing something?


How to keep a link from a row inside a collection to a file

Posted: Wed Jun 18, 2014 1:36 am
by Deep

Hi,
Please let me know how do I get the appery generated filename or fileurl in the response of the upload service after the upload is successful. I tried using the return value of uploadMultipleFilesHelper function, but it did not work.
Thanks again.


How to keep a link from a row inside a collection to a file

Posted: Wed Jun 18, 2014 7:11 am
by Evgene Karachevtsev

Hello,

uploadMultipleFilesHelper returns nothing, we suggest you do not use it. You should create servise and use it, for exampes as on screenshots:
Image
Image
Image
Image


How to keep a link from a row inside a collection to a file

Posted: Wed Jun 18, 2014 3:56 pm
by Deep

Hi,
I was able to get the return filename from the standard upload service response.
data[0]].success.filename and data[0].success.fileurl
Thanks.


How to keep a link from a row inside a collection to a file

Posted: Thu Jun 19, 2014 4:46 am
by Deep

I did not find a way to keep a pointer column in my collection that will point to a file. Is there any?


How to keep a link from a row inside a collection to a file

Posted: Thu Jun 19, 2014 7:20 am
by Evgene Karachevtsev

Hello,

Unfortunately you can't use pointer on collection files. As option you may store file name from collection files in your user collection. And get file according to this API: http://devcenter.appery.io/documentat...