leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem Loading a Pdf File

Any help on this?

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem Loading a Pdf File

A little more info. As said earlier, the database "magpdf" has pdf files and 3 collections.

Here is one of magpdf collections, mmag. This collection references the filenames in files as shown below (but is not the actual filename of the file):
Image

Here is the magpdf files showing a set of different filenames (the real filenames needed to open the pdf files):
Image

The filenames in the mmag collection are wrongly mapped to the pdfname:
Image

In creating the service, there is no corresponding list item for files read service to map the needed filename to the pdfname on the UI:
Image

Image

How should I map the filenames in the database files to the label component of the UI to capture the filename and use it to open the pdf?

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem Loading a Pdf File

Just not sure what else to do here to get an answer...

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Problem Loading a Pdf File

Dear Leonardo,

We are striving to reply all users as faster as possible.
We'll get back with updates as soon as have new.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem Loading a Pdf File

Thanks. I appreciate that, because I'm stuck and can't proceed.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Problem Loading a Pdf File

Hi Leonardo,

It seems you have passed to your code not correct fileName.

Please try following JS code:

pre

var thepdf = $(this).find("[name=pdfname]").text(); // thepdf here is: h2013-2.pdf

var pdf= 'https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/' + thepdf;
masterKey='abe75e48-f875-47be-946a-502e7d7566b2';

console.log("pdf = '" + pdf + "'");

window.open(pdf, '_system');

/pre

Then open console and take a look what actual URL you have.

Thanks.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem Loading a Pdf File

Hi Yurii:
This is the console info:
code
GET https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/h2013-4.pdf 404 (Not Found)
Navigated to https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/h2013-4.pdf
/code

Also, no matter what item I clicked, it still gives the same message without updating the actual pdf clicked.

It seems to me that the issue is that the database substituted a unique id instead of the real filename when the items were uploaded. If I manually put the unique id and the filename it works, eg.
code
'https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/' + '4b23fed0-cad4-47b5-974c-1d825d99953a.h2014-3.pdf'
/code

The key is how to get the long id/filename of the file collection. The Url seems to be correct, it's just accessing that piece of information that's the problem. Couldn't imagine it would be this hard.

I've shared the app, please feel free to check it out.

Thanks for your help.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Problem Loading a Pdf File

Hi Leonardo,

pre

https://api.appery.io/rest/1/db/files/54bd8eb7e4b03b3a80116534/h2013-4.pdf

/pre

It seems your link uses file "originalName" you need to use file "fileName" instead.

See details on screen shot: http://prntscr.com/6hc5e2/direct

Regards.

leonardo
Posts: 0
Joined: Thu Mar 14, 2013 7:04 pm

Problem Loading a Pdf File

Hi Yurii:

I'm not sure you understand my plight here. As expressed above, I already know that is the originalName and that I need the fileName. But as I mentioned, my page is mapped to a separate collection, but I need to map the fileName from the file Collection to it. That is what I'm having problem with.

So far, I see that to have access to the file collection I need to create a login Service. I have done that and can now see Response results from a test from the file Collection. But still, I couldn't get the filename to show from it. These are my current settings:
Image
Image
Image

Also, from your link I see that the Owner and ACL info are filled in your example. Mine is not. Does that make a difference? Where is that setting done?

Image

Also, by the way, say I select an item that has a value of "2013-1" in the UI, how can I code it in javascript to says: select the file that has "2013-1" in the filename? If I can do that, are there prerequisite settings I need to do first to access the name?

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Problem Loading a Pdf File

Hi leonardo,

It seems you have incorrect response parameters for your read service(but i'm not sure cause of not enough info):
Details: http://prntscr.com/6i6p4v/direct

Please describe your app workflow step-by-step.

For example:

  1. User uploads the file.

  2. User see all uploaded files.

  3. User check one one of them.
    .......

    Thanks.

Return to “Issues”