File upload to folder: file name and hyperlink are not shown (v2021)

Hi,I’m testing PHPMaker 2021.0.8 publishing a list of invoices (date, file name, description, amount). I created a new project (not a imported one) in v2021 and followed the file upload to folder tutorial but file name field is not shown (blank space) nor the hyperlink to the file itself.If I change the field property to text box.. is listed without problems.

I think I followed installation requirements (composer is working, packages downloaded, etc.), PHP 7.4, plesk server, etc.Any suggestion? Thank you!Jaime

What is the field name? Is it file name (contains space), or filename (not contains space) ? If it contains space, try to remove the space from the field name, re-synchronized again your project to the latest database schema, re-generate ALL the script files, and try again.

Field name is “fra_archivo”; field type is VARCHAR (100) and examples of data stored are: “FA201672.pdf”; “FA203074.pdf”, etc. no space.Jaime

Press F12 from your browser, and see whether any Javascript error message from Console section.

I add: file submission works: if I add a record, the file is correctly uploaded to the server, the file name is stored in the field… but in the list view “a big” blank is shown instead the file name and the hyperlink to the file.If I edit the record, the file is shown correctly (even the pdf preview, that it’s the case) and I change the file.I set debug mode and everything it’s ok.Strange…Jaime

mobhar wrote:

Press > F12 > from your browser, and see whether any Javascript error
message from > Console > section.

Hi,Yes, there ares some Javascript errors:Failed to load resource: the server responded with a status of 401 ()
DxNFY41yzP04fA7qtVhXO8bbB3FJYLYxor4y1dr53GYvRH7BiLqJkkGk6AAkFqqUiPWfzZ6E4QLKPWMeg38SUdXwk2kKXRMoJZUnYyvcJrb-GEvW4x6KZQ…:1 Failed to load resource: the server responded with a status of 401 ()
EM909DT-ZJT0t2KCyNpKDthfo7Os2KkLsRa-8IQ5TRaHto7Hnl3HV4fPwKdeWyUshOZlIUWq1ZosR418rxBv8FgGRrJXkN2k38vprSVTIP7arLP1oApSmA…:1 Failed to load resource: the server responded with a status of 401 ()
KS53RFIVEYZ0UlTxZfe6b2-tiZEQYMX2SNHa5OPQViJX7ZbHj19T_pQlN_4VY4EzMpkYM2m6CYNH8CMALsU723as7koj0XuF2CGnyPjcBy8CDwPYXEpLTBTeOFlxul1Jfn5yfLm8ApZ2hBea:1 Failed to load resource: the server responded with a status of 401 ()
zvWx09giLTSeAix8dd-8Gyd-eWZme_HrUuLSz6e0BY-Dzo1Dt5Dn3Ju3lYbdAOkX1Rl_7pBdCRccMd2fOU5amz89gDWU5XyU7wCKgsjbgnI2zg_PIV6jmQ…:1 Failed to load resource: the server responded with a status of 401 ()Jaime

The 401 Unauthorized Error is an HTTP response status code indicating that the request sent by the client could not be authenticated. A 401 Unauthorized Error indicates that the requested resource is restricted and requires authentication, but the client failed to provide any such authentication.This might occur in one of a handful of possible scenarios:

  1. The client sent its authentication credentials to the server, but the server has rejected the credentials for some reason.
  2. The client failed to provide any authentication credentials within the request.
  3. The client is banned for some reason. Some applications use 401 Unauthorized Errors to restrict access requests from specific IP addresses, so if authentication is not the issue, a server-side ban could be the problem.

More information I get, if it help someone to provide a clue to solve these errors:-I’ve disable embed pdf documents in advance settings and now I can see get the file name and its hyperlink to the document in the list table.
-It seems that there are a problem in the list view that affects not only the pdf thumbnails but the hyperlinks
-If I edit a record, I can see the thumbnail of the pdf document and if I click the link of the stored document I can download it without problems.
-If I click the hyperlink in the list view… I get a 401 error page: the same error when trying to get the pdf thumbnail.These are the links:1) Hyperlink to one document in the list table (I get 401 page): https://app.retamar.com/factu_new/api/file/alumnos/S9QXGOuPu0XLIVvG1BqWAsqQDKRd047yqqitBht5M0mFgfb3vhSimvdK56sZLlteUFySuP6wHeiUiF-ahMw6WrFiNPHJB6oRw3W8P-KGZfS267LIk_clkw…?session=XRa2IhxMfYJlNsNOZK7eSIF8BM71KrrLJTsXBmTct38.&csrf_name=csrf5ff704c2768c3&csrf_value=cf4faf33b4b8b03d289c0f636b2b150e2) Hyperlink to one document in the list table (It works: document downloaded): https://app.retamar.com/factu_new/api/jupload?rnd=396764430&csrf_name=csrf5ff704e0074d1&csrf_value=ce3a0221278251a2fb40ba7bbcb37b9f&id=x_fra_archivo&table=alumnos&session=XRa2IhxMfYJlNsNOZK7eSIF8BM71KrrLJTsXBmTct38.&x_fra_archivo=FA2051.pdf&download=1Jaime D.

As you can see from the URL, the URL to the API uses different API actions (“api/file” vs. “api/jupload”) in List/View pages and Add/Edit pages, they work differently. You need to focus on why you get 401 (no permission) in the List/View page. If you use User Level Security, make sure the user has List/View permission to the table.

Thank you for the information on API: as you say I have to focus on the list/view page.Security is well configured by user ID: that’s what I usually set in my projects.I’ll keep looking for the solution. Thank youJaime

enfoque_traza wrote:

Security is well configured by user ID: that’s what I usually set in my projects.

User ID Security (which is record level) is not related to 401 error. You need to check your User Level Security (which is table level).

User Level Security feature is disabled by default, so it should not affect my project.Jaime

If you are a registered user, you may send the required information to support, see https://phpmaker.dev/support.php.

I’ve written them, thank you.

hello did you solve it i have the same problem