Problem with files/photos on elgg update from 1.8 to 2.3

Hi guys, recently I just updated a very old elgg installation from 1.8 to 2.3, following step by step and minor version by minor version I ended the process and everything seems to work fine but "files" or "photos" not.

The files are in the server, with the correct permissions for webserver, the integrity of the database is correct, all users are working ok but no download link for the files appear. On the "photos" the same occur, all the files appear with a "?" but the albums and the metadata are ok.

What could be wrong? Any tips or pointers about how to solve this? If I upload a new file appears correctly with its download link but old files not.

Thanks and regards



  • Elgg 1.9 introduced the possibility of executing upgrade script from the admin section that are not executed when running upgrade.php (or clicking the Upgrade button on the admin dashboard). There's a new sidebar entry for these scripts in the admin section. It's for example useful for long running scripts that you might want to have some control of when to run them.

    With Elgg 1.9 two of these upgrades would have to be executed after updating from 1.8. On update converts comment annotations to entities (as new comments are now also saved as entitites). The other script overhauls the data directory structure and moves the files in it to the new structure.

    Have you executed these scripts? Are any pending upgrades shown? If the data directory migration hasn't been made, the old files and photos can't be found (while any new uploads are already saved according to the new structure).

    Of course, you also need to make sure that you upgrade 3rd party plugins to versions that are compatible with the new version of Elgg. With Tidypics you most likely also need to run a Tidypics-specific upgrade (execution can be started from the Tidypics plugin settings page). This Tidypics upgrade is to be run only after the Elgg core upgrades have already been finished.

    Only with the core updates and Tidypics upgrade finished the files and photos will show again and other stuff will work correctly. Other 3rd party plugins might also require some after-upgrade maintenance. If that's the case it's likely written in the readme or changelog of the plugins.

    And if you use a 3rd party plugin written for Elgg 1.x on Elgg 2.x it might cause some problems, too, like causing other plugins to fail. If a new version of a plugin is available for a Elgg 2.x version, upgrade. Or check at least if the plugin developer recommended the version of the plugin in use also for Elgg 2.x. If there's no new version and no info from the plugin developer, a plugin might work or might not. In this case you can only test it to see if there are problems (or disable it temporarily to see if any existing problems don't occur without such a plugin).

  • First thanks for your detailed answer. Then yes, I've run the process during the upgrade but I think now that some failed because in the "upgrades" section in administration view there is a pair of links: "Comments Upgrade" and "Data directory upgrade". I'm almost sure that I run this during the upgrades, but maybe possible that failed o just completed one part? If I click in both (data directory upgrade or comments upgrade) it shows to me an "Invalid admin section" error. And does nothing. Can this process be launched manually using command line? So I think that you're correct, the problem was in the new directory/data structure. But how can I fix it? Can i re-run manually from command-line the script? It seems that doesn't work from web interface. I used tidypics but directly the version for elgg 2.3 and nothing appears in the tidypics configuration page about upgrades. Seem everything ok with the plugin.

  • Wow, I'm experiencing very rare behavior. I tested the migration process in a new clean virtual machine and I've been upgrading version by version. In this machine Ubuntu Server 14+Apache2+PHP 5.4 everything works ok. When I copied the elggdata, elgg files and database to production server (Ubuntu 17+Apache2+PHP7) this time the photos shows correctly but the files cant download. If I activate the debug I see:


    WARNING: Deprecated in 2.2: /file/download page handler has been deprecated and will be removed. Use elgg_get_download_url() to build download URLs Called from [#6] /home/www/elgg/mod/file/start.php:164<br /> -> [#5] unknown, referer:
    [Thu Aug 31 19:06:35.467560 2017] [:error] [pid 27120] [client] NOTICE: Unable to resolve resource URL for a file that does not exist on filestore, referer:


    But I'm sure that the file exists in the elggdata folder and this time the data structure folder has been correctly ported to new structure. It works in an older server but not in production server. I checked the config of both apache2 and seem ok... this sounds like a problem with php7 or maybe a problem with permisions or with redirect of .htaccess? I have no idea, both dirs have permisions for apache and have read, write and execution permisions....

    Any tips or pointers in this case? thanks

  • As these two upgrades were supposed to be run on Elgg 1.9 when upgrading from Elgg 1.8 it is likely that they fail to run on later versions of Elgg (even more likely on Elgg 2.0 or later).

    If Tidypics photos work now, one problem solved...

    The download url for files is different on Elgg 2.3 (maybe it already changed on Elgg 2.2). It seems to work fine for me when testing. Could it be that your theme plugin (or another 3rd party plugin) interferes here and alters the download button (and underlying download url)?

  • Hi guys, @mklog @iionly

    I have the same problem with the download URL, I updated my Dev site before make modifications in my production site from 2.1.1 to 2.2.0 and I disabled all the plugins except the Files, to see if that was it and it does not work

    If I upload a new file it works fine, but the old files I uploaded in version 2.1.1 appear, but do not download them and preview either.

    I have read that in version 2.2 the download url is changed because the handler changes in several things, here I found the information:

    File entity thumbs and downloads are now served via serve-file handler. Plugins should start using elgg_get_inline_url() and elgg_get_download_url() and note that:

    • file/download page handler and resource view have been deprecated
    • mod/file/thumbnail.php file has been deprecated
    • Several views have been updated to use new download URLs, including:
      • mod/file/views/default/file/specialcontent/audio/default.php
      • mod/file/views/default/file/specialcontent/image/default.php
      • mod/file/views/default/resources/file/view.php
      • mod/file/views/rss/file/enclosure.php

    I have made the security updates from version 2.1.1 to 2.1.3 and then to 2.2.0 following the updates manual.

    Of course I have performed the procedure of clicking upgrade in the url of my site and in the admin panel.

    Something did not work in step 2.1.3 to 2.2.0.
    I guess something changes in the database that indicates those changes, I have looked but I have not been able to locate them.

    If anyone could help me with this question.



  • @dragonjon I'm not sure I fully understand your issue. What I get is that you have a problem with download files previously uploaded on Elgg 2.1 after upgrading to Elgg 2.2. While it works to download files that were uploaded on Elgg 2.2 the problem is only with the older files, right?

    Is that the (only) problem you are referring to? You mentioned "something did not work in step 2.1.3 to 2.2.0" and I'm not sure you are referring to the file download issue or mean something else went wrong.

    The information in the docs about changes in the Elgg API regarding file download should be irrelevant to you in case with the bundled Files plugin as the changes have been made in the code of the new Elgg releases already. Only in case you use a plugin (that also includes theme plugins) that overrides the Elgg core functionality it might be necessary to update the code of these plugin(s). But I don't think this is the cause for your problem either because you say that the new files can be downloaded (it would be rather a fully working or not working at all issue if the code would be in need to be updated). Anyway, Elgg 2.2 - 2.3 should be backward compatible still, so you would get a deprecation warning in the logs rather than a failure in download.

    Possible way to fix the issue (if the download issue is the only issue you are referring to to have since upgrading to Elgg 2.2) could be to upgrade to the latest Elgg 2.3. There have been bugfixes since then and maybe one of the fixes addressed the issue you are referring to. If the issue would still be unresolved on the latest 2.3.4 then it would be time to open an issue about it at github as then it might be a bug in Elgg indeed.

  • Hi @iionly, sorry for not replying before I did the whole update process ending in 2.3.4 as you recommended but the problem of downloading files was not solved. But reviewing the database and how I imagined a value of a field of each file is different in old files and new ones.
    Specifically in the metadata table, in the name_id column and the value of that name_id in the metastring table is filestore :: dir_root my old and new files had different value_id that in the metastring table corresponded to different route values ​​inside the server.
    To solve this, I have changed in the metadata table all the values ​​of value_id that corresponded to the name_id with the value of the metastring table with the same id = filestore :: dir_root, for the value_id that the new files had.
    Just like it was a recklessness but with a bit of analysis I was able to solve the problem and I'll be able to start upgrading my production version to more modern versions of Elgg.

    I think the problem came by following the instructions to duplicate the installation for development, since there is a part that I think made that modification is the part that says:
    Change the filestore data directory with an SQL string
    I'm not sure if updating version directly into the production version without having to do a server address change in the database causes the same problem, I hope not.

    Thank you very much for helping me in this matter.


  • If the path to the data directory is not the same on the development server and production server you would need to update the filestore entry in the database as described in the "duplicate site" instructions.