jDownloads Support Forum

Other Themes => Joomla - General Topics => Topic started by: Arno on 02.06.2020 09:56:25

Title: File size 0 when use external file link for internal located file
Post by: Arno on 02.06.2020 09:56:25
Reported by user via e-mail:

QuoteAfter one of last updates (currently my version is 3.2.68) the file size of newly added files does not work. After saving an entry for new file it populates file size with 0 B.

What I'm doing is:
1.       I manually upload a file via FTP to the server to an appropriate folder in my catalog

2.       I create new entry in jDownloads for new file. I use relative path like "./my-folder/my-subfolder/uploaded-file.pdf" which I type in "external file link" field. The "Is the main file on an external web page?" is set to "No"

Everything else works perfectly. The file is downloadable when published, downloads counter increases when people download, all data is displayed, content plugin works, etc.

I have on my site over 100 files published this way and everything was working this way until I'd say 2-3 months ago when I uploaded a file for the last time. Now it does not work – I mean: it does not calculate automatically the file size, so I need to do it manually when I create entry for new file.

Can you please check what happened?

My Joomla version: 3.9.18
jDownloads: 3.2.68
PHP: 7.2.31

I must say that this is not the normal way to assign a file. It would much be easier to upload the files to the root folder and select the file easy in the edit page.
Title: Re: File size 0 when use external file link for internal located file
Post by: ColinM on 02.06.2020 17:36:46
Hi
If you look at the documentation it advises that jD cannot determine the size of an External file.This is because in general jD cannot guarentee access to the file properties of a real external file.
Yes it is sometimes simpler to upload a set of files to become downloads using say an FTP program. But if you load them into the correct directory/subdirectory you can then run the monitoring from the jD Control panel and it will turn each file into a Download automatically.  You might need to add description, preveiws and the like but Jd will then determine file size and type.
Colin
Title: Re: File size 0 when use external file link for internal located file
Post by: przemko on 06.06.2020 19:27:33
Hi Colin,

That was me who reported this by email :)
Let me try to clarify.

I am using jDownloads for I think over 10 years and it works great. Thank you for that!
Our site contains a structure of products (board games) where in each folder we have several files related to a game (rulebooks, pictures, and other game-related materials). These folders are structured in a tree way, where in first level we have games, in second several folders with expansions to these games, and inside there may be also folders with various content related to a game or expansions.
jDownolads is used only for rulebook downloads.
That is why in our opinion using different folder structure for rulebooks (jDownloads) and different structure for other files (non-downloadable) is not a good idea. Also - these files are already indexed by google, so we do not want to reorganize them.

The bug is that files we are referring to in jDownloads are not on external server. They sit on exactly the same server as jDownloads but just in non-default jDownloads folder. I call it a bug because we set-up everything like this 10 years ago and it was working fine up to few months ago - the size was calculated properly.

In addition, I want to say that we use jDownloads according to its features. Please have a look on the "Screen1" picture. You can see there is a section where you provide the link (and we provide a relative link to internal file "./path/file.pdf") and we also set the parameter called "Is the main file on external web page" to "No".
The logic thinking leads to conclusion that when we say that the "external" file is not on "external" server means that the "external" file is on local server, right?

So, ending this a bit long explanation: my file is on local server (not external server) and the size is not calculated during saving the data (even if it was working properly few versions ago).

Basing on the above I claim this as a bug because a developer didn't catch this anomaly when she/he run a regression testing after a change was made in that part of code.

On Screenshots you may see step-by-step process which I went through:
Screen 1: The path to local file is provided, but "Save" button was not hit yet.
Screen 2: After data is saved, the size is automatically populated with "0 B".
Screen 3: In the front-end everything works, file is downloaded "0" times (unfortunately file size is not shown at all)
Screen 4: When I download and refresh, it shows "1", so counter works properly. File is also downloaded correctly
Screen 5: I manually set the size and save
Screen 6: After refresh, the front-end shows correctly the data, also file size now is displayed (it was not in step 3)

Would be great to fix the file size calculation for files which are on the same server just in non-default directory.
Title: Re: File size 0 when use external file link for internal located file
Post by: Arno on 08.06.2020 13:17:34
Hi przemko,
many thanks for your intensively description. I will try to fix it shortly but I'm at the moment very busy. So I need more time for it.  :-\
Title: Re: File size 0 when use external file link for internal located file
Post by: przemko on 08.06.2020 15:10:59
Thank you Arno!
This is not a time critical thing, but would be great to have this fixed at some point.