We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10525
    • 247 Posts
    modx 2.3.3

    So, I can insert a new image into the page content via the wee image icon in the rich text editor (TinyMCE in the system settings)
    > Insert/Edit Image popup
    > Image URL Browse button
    > "MODX :: MODX Resources Browser" popup.

    However when I try to upload a new image it all reports OK:
    Upload destination: assets/images/
    upload successful
    But there is no image there and no image of that name anywhere on the server.

    When I try uploading a new image by clicking the TV image browse button to get the "MODX Browser (web)" popup, the same happens: I can use an existing image but can't upload one.

    I tested the procedure on another 2.3.3 site and images upload ok.
    I compared the system settings between the two and the only differences are as follows:
    Site that doesn't upload images:
    parser_class | parser_class | fastFieldParser
    parser_class_path | parser_class_path | {core_path}components/fastfield/model/fastfield/
    Settings Distribution | settings_distro | traditional
    Settings Version | settings_version | 2.3.3-pl
    Site that uploads images ok:
    - absent -
    - absent -
    Settings Distribution | settings_distro | advanced
    Settings Version | settings_version | 2.3.3-pl
    (I have no idea why I have these differences. I usually download the Traditional updates).

    Both sites sit on the same server, although there could be differences in domain-specific settings.

    Any ideas why this is happening and how I can fix it?

    Thanks.

    This question has been answered by Gav. See the first response.

    • I have fastfield on most of my sites, and they all handle image uploads just fine. It could be file permissions; are you sure the location you are uploading the file to has the correct permissions?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
      • This could be related to your media source configuration, maybe something's off there?
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 10525
          • 247 Posts
          It hadn't occurred to me that fastfield might be an issue, Susan. I hardly remember installing it! Permissions look fine on the images dir (777).

          Yes, Mark, one difference between the two sites is that the one that doesn't work is set up with an additional media source (for client manager users), whereas the one that works is just the default with only me as admin. I don't know when the upload issue started, or what it coincided with. Is there a checklist for media source setup, or testing methods?

            • 10525
            • 247 Posts
            Checking the settings for media sources:

            The default "Filesystem" media source on both sites:
            basePath | Textfield |
            basePathRelative | Yes/No | Yes
            baseUrl | Textfield |
            baseUrlRelative | Yes/No | Yes
            allowedFileTypes | Textfield |
            imageExtensions | Textfield | jpg,jpeg,png,gif
            thumbnailType | List | PNG
            thumbnailQuality | Textfield | 90
            skipFiles | Textfield | .svn,.git,_notes,nbproject,.idea,.DS_Store
            The additional "Uploads" media source in the site that doesn't work:
            basePath | Textfield | assets/uploads/
            basePathRelative | Yes/No | Yes
            baseUrl | Textfield | assets/uploads/
            baseUrlRelative | Yes/No | Yes
            allowedFileTypes | Textfield |
            imageExtensions | Textfield | jpg,jpeg,png,gif
            thumbnailType | List | PNG
            thumbnailQuality | Textfield | 90
            skipFiles | Textfield | .svn,.git,_notes,nbproject,.idea,.DS_Store

            The image upload failure occurs for both the main Admin user (me), using the "Filesystem" media source, as well as the client manager user, using the "Uploads" media source.
              • 10525
              • 247 Posts
              btw how is this method of file uploading carried out? Is it via ftp or ssh? Wiould be useful to know for checking firewall etc.
                • 10525
                • 247 Posts
                Anyone?
                  • 10525
                  • 247 Posts
                  OK, a strange thing occurs as I try to uninstall packages (or extras, whichever they are called) - some appear to uninstall (title goes grey and Install button appears), while others apparently fail.

                  Example report for a Package which appears to stay installed:
                  Console running...
                  Finding package with signature: getresources-1.6.1-pl
                  MODX could not download the file. You must enable allow_url_fopen, cURL or fsockopen to use remote transport packaging.
                  Could not transfer package getresources-1.6.1-pl.transport.zip to /var/www/vhosts/mydomain.com/httpdocs/core/packages/.
                  Package found. Preparing to uninstall.
                  MODX could not download the file. You must enable allow_url_fopen, cURL or fsockopen to use remote transport packaging.
                  Could not transfer package getresources-1.6.1-pl.transport.zip to /var/www/vhosts/mydomain.com/httpdocs/core/packages/.
                  Package successfully uninstalled with signature: getresources-1.6.1-pl
                  I checked the php config and lo and behold, allow_url_fopen is disabled. Checking the site that works, and allow_url_fopen is set to 'on'. No idea why this is or when it was changed, but will test this as the possible reason for upload failures.
                  • discuss.answer
                    • 10525
                    • 247 Posts
                    File upload issues solved:
                    PHP's allow_url_fopen was switched off for that domain. No idea why or for how long, but it is a Plesk-controlled thing. Probably done in error a while back.

                    While the cause was stupidly simple, it took me a week to track this down: searching mod_security, apache and modx error logs, testing without extras, playing with dir permissions, hammering google to death. If only there could have been an error message telling me that an attempted file upload could not be carried out because allow_url_fopen was switched off. I know it is maybe not wise to display such an error message for any old manager user, but a line in an error log would be very useful.

                    Luckily, it was the error I saw while trying to uninstall packages (above) that alerted me to this in the first place.

                    On that subject, even though I have activated allow_url_fopen, I still can't uninstall getResources!
                    Uninstall mode: "Uninstall":
                    Console running...
                    Finding package with signature: getresources-1.6.1-pl
                    Could not open file for reading: getresources-1.6.1-pl.transport.zip?revolution_version=Revolution-2.3.5-pl
                    MODX could not download the file. You must enable allow_url_fopen, cURL or fsockopen to use remote transport packaging.
                    Could not transfer package getresources-1.6.1-pl.transport.zip to /var/www/vhosts/mydomain.com/httpdocs/cfm2/core/packages/.
                    Package found. Preparing to uninstall.
                    Could not open file for reading: getresources-1.6.1-pl.transport.zip?revolution_version=Revolution-2.3.5-pl
                    MODX could not download the file. You must enable allow_url_fopen, cURL or fsockopen to use remote transport packaging.
                    Could not transfer package getresources-1.6.1-pl.transport.zip to /var/www/vhosts/mydomain.com/httpdocs/cfm2/core/packages/.
                    Package successfully uninstalled with signature: getresources-1.6.1-pl
                    The message has a new 2nd line, but it still reports the error and says it has uninstalled, when it hasn't. I looked in the core/packages dir and the getresources-1.6.1-pl dir was there, but getresources-1.6.1-pl.transport.zip wasn't. I suppose the mismatch occurred when I tried to uninstall with allow_url_fopen inactive. I just removed the package completely (with the buttons), re-downloaded it, installed and all back to normal. Now I can uninstall, remove and reinstall no problem.

                    No entries for any of this in the modx error log though, even with log level set to 4. Is that normal?