Deep
Posts: 0
Joined: Mon Jun 16, 2014 3:55 pm

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

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?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Deep
Posts: 0
Joined: Mon Jun 16, 2014 3:55 pm

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

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?

Deep
Posts: 0
Joined: Mon Jun 16, 2014 3:55 pm

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

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.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

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

Deep
Posts: 0
Joined: Mon Jun 16, 2014 3:55 pm

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

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.

Deep
Posts: 0
Joined: Mon Jun 16, 2014 3:55 pm

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

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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

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

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...

Return to “Issues”