Steve Burton
Posts: 0
Joined: Mon Feb 03, 2014 7:07 pm

Retrieve specific files from Files Collection

I have successfully managed to add files to the Files collection using your Documentation / Tutorial. However, I can find no way of retrieving specific individual files from the Files Collection and displaying them other than to manually find the file_name column value and create an html string such as View File. How can I query these files and retrieve the file_name so that I can create a javascript event to build the html for specific files?

Steve Burton
Posts: 0
Joined: Mon Feb 03, 2014 7:07 pm

Retrieve specific files from Files Collection

Hi Katya
Thanks for getting back to me.

I understand how to use 'where' but I don't understand how to get the file_name when I upload the file and the row is created within the Files collection. The file_name appears to be a long number followed by the original file name. How can I save the file_name when I upload the file?

Steve Burton
Posts: 0
Joined: Mon Feb 03, 2014 7:07 pm

Retrieve specific files from Files Collection

Hi Katya

I have managed to find a solution using:

localStorage.setItem('db_file_url',data.fileurl);

I can now upload files successfully and get the URL for accessing them into a local storage variable, however, the files are either blank pages or are corrupt when uploading standard PDF files. Any ideas how to fix this?

Thanks in advance
Steve

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Retrieve specific files from Files Collection

Hello! You have only PDF files broken while uploading or there are another files? Have you tried to upload short .txt file or image?

Steve Burton
Posts: 0
Joined: Mon Feb 03, 2014 7:07 pm

Retrieve specific files from Files Collection

I have testing uploading by uploading a one line .txt file and it works. I have tried uploading a 20kb .jpg file and is doesn't work

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Retrieve specific files from Files Collection

Hello! Could you give us direct link to broken uploaded files (image or PDF)?
http://docs.appery.io/documentation/b... (see Direct link to a file)

Steve Burton
Posts: 0
Joined: Mon Feb 03, 2014 7:07 pm

Retrieve specific files from Files Collection

Hi Maryna

Below is an example of a PDF file that was uploaded and this was the URL that I retrieved/stored at the point of upload.

https://api.appery.io/rest/1/db/files...

Regards
Steve

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Retrieve specific files from Files Collection

Hello! Looks like you've done some mistake. Please follow the tutorial and check. If it still doesn't work give us your public app link and steps to reproduce.

Steve Burton
Posts: 0
Joined: Mon Feb 03, 2014 7:07 pm

Retrieve specific files from Files Collection

What have I done wrong. I have followed the tutorial and it works for .txt files just not for .pdf files. I cannot see what else I can do to fix this. Please help?

Return to “Issues”