[Resolved] Unable to upload logo image: Unable to write to:/support/osta/uploads/

  • June 6, 2020 at 7:23 am #5969
    m
    mayberts
    Participant

    I don’t seem to be able to upload custom images.  /osta/uploads is there and permissions are 755

    Not sure how to troubleshoot this.

    osTicket v1.14.2 // osTicket-1.14.2-Awesome-102
    PHP 7.2.24-0ubuntu0.18.04.6 // MySQL 5.7.30 // Apache/2.4.29 (Ubuntu) web server

    thanks

    mayberts

  • July 8, 2020 at 6:45 am #6033
    e
    esbd
    Participant

    Hi,

    We just bought this template and we are facing the same issue  with same version. Can you please help ?

    osTicket v1.14.2 // osTicket-1.14.2-Awesome-102
    PHP 7.2.24-0ubuntu0.18.04.6 // MySQL 5.7.30 // Apache/2.4.29 (Ubuntu) web server

    /osta/upload folder exists and rights are correct 755.

    Thanks

  • July 8, 2020 at 8:23 am #6035
    m
    mayberts
    Participant

    I found a workaround, I uploaded our image using WINscp

  • July 8, 2020 at 1:46 pm #6039
    stevland
    Keymaster

    It is a really interesting coincidence that you are both experiencing the same problem out of the blue.

    I also notice that you both have the exact same software environment:
    PHP 7.2.24-0ubuntu0.18.04.6 // MySQL 5.7.30 // Apache/2.4.29 (Ubuntu) web server

    MySQL 5x is still supported by osTicket, I believe, but probably not for long as it is seriously outdated. I recommend updating to 7x. It would seem unrelated to this, but how knows? It may help.

    EDIT: I clearly need to drink more coffee. I was conflating PHP with MySQL. MySQL 5x is completely fine.

    Please check your Apache error logs for relevant errors around the time that you attempt to upload a file. Let me know.

    In addition to setting the upload directory permissions to 755, please verify that the directory owner is the same account that your main website runs under.

    Finally yes, using an FTP program (such as WinSCP or FileZilla) is a good workaround. I’d prefer to have things working as expected on your end, but luckily uploading logos or backgrounds isn’t the type of thing you’re likely to do very often.

  • July 16, 2020 at 12:43 am #6078
    m
    mayberts
    Participant

    I have updated mysql and still getting the same error.

    osTicket v1.14.2 // osTicket-1.14.2-Awesome-102
    PHP 7.2.24-0ubuntu0.18.04.6 // MySQL 8.0.21 // Apache/2.4.29 (Ubuntu) web server

  • July 16, 2020 at 9:19 am #6081
    stevland
    Keymaster

    @mayberts,

    Please check your Apache error logs for relevant errors around the time that you attempt to upload a file. Let me know.

    In addition to setting the upload directory permissions to 755, please verify that the directory owner is the same account that your main website runs under.

    On my system it looks like this

    # cd osta
    # ls -l
    drwxr-xr-x. 3 osticketawesome psacln 4096 May 23 20:16 css
    drwxr-xr-x. 3 osticketawesome psacln 4096 May 23 20:16 icons
    drwxr-xr-x. 4 osticketawesome psacln 4096 May 23 20:16 img
    drwxr-xr-x. 2 osticketawesome psacln 4096 May 23 20:16 inc
    drwxr-xr-x. 3 osticketawesome psacln 4096 May 23 20:16 js
    drwxr-xr-x. 5 osticketawesome psacln 4096 May 23 20:16 opt
    drwxr-xr-x. 2 osticketawesome psacln 4096 May 23 20:16 php
    drwxr-xr-x. 3 osticketawesome psacln 4096 May 23 20:16 svg
    drwxr-xr-x. 2 osticketawesome psacln 4096 Jul 13 23:20 uploads
    -rw-r--r--. 1 osticketawesome psacln 198 Dec 17 2019 user-scripts.js
    -rw-r--r--. 1 osticketawesome psacln 276 May 23 20:38 user-styles.css
    -rw-r--r--. 1 osticketawesome psacln 27 May 23 20:18 version.txt

    In my case the owner of the uploads directory is osticketawesome, which is the account that my website runs under. And psacln is the group that the account belongs to.

    If you uploaded the files as another user (for example, as root), that would explain your issue.

    What do you see when you use the ls -l command?

  • July 16, 2020 at 9:43 am #6082
    m
    mayberts
    Participant

    this is what mine look like,  I will check Apache logs now

    drwxr-xr-x 3 mdadmin mdadmin 4096 Jul 8 19:33 css
    drwxr-xr-x 3 mdadmin mdadmin 4096 Jun 6 14:22 icons
    drwxr-xr-x 4 mdadmin mdadmin 4096 Jun 6 14:22 img
    drwxr-xr-x 2 mdadmin mdadmin 4096 Jun 6 14:22 inc
    drwxr-xr-x 3 mdadmin mdadmin 4096 Jun 6 14:22 js
    drwxr-xr-x 5 mdadmin mdadmin 4096 Jun 6 14:22 opt
    drwxr-xr-x 2 mdadmin mdadmin 4096 Jun 6 14:22 php
    drwxr-xr-x 3 mdadmin mdadmin 4096 Jun 6 14:22 svg
    drwxr-xr-x 2 mdadmin mdadmin 4096 Jun 8 11:09 uploads
    -rw-r–r– 1 mdadmin mdadmin 198 Jun 6 14:05 user-scripts.js
    -rw-r–r– 1 mdadmin mdadmin 267 Jun 6 15:32 user-styles.css
    -rw-r–r– 1 mdadmin mdadmin 27 Jun 6 14:05 version.txt

    • July 16, 2020 at 10:09 am #6084
      stevland
      Keymaster

      @mayberts,

      drwxr-xr-x 2 mdadmin mdadmin 4096 Jun 8 11:09 uploads

      So your uploads folder is owned by the mdadmin account.

      If you run the ls -l command in the root directory of your main website, are those files also owned by mdadmin?

  • July 16, 2020 at 9:52 am #6083
    m
    mayberts
    Participant

    Apache error log.

    PHP Warning: move_uploaded_file(): Unable to move ‘/tmp/phpQHnhJe’ to ‘/var/www/tickets/osta/uploads/Logo.png’ in /var/www/tickets/osta/php/functions.php on line 141, refere$

    • July 16, 2020 at 10:19 am #6085
      stevland
      Keymaster

      @mayberts,

      PHP Warning: move_uploaded_file(): Unable to move

      That error does seem specifically related to an ownership/ permissions issue. Your permissions seem fine, so it must be something to do with ownership.

      See this link:
      https://stackoverflow.com/questions/13723174/php-warning-move-uploaded-file-unable-to-move

      Actually, it may be a Ubuntu thing. It may help to set the user and group to www-data. I have found a few search results where this worked for Ubuntu users:

      # chown -R www-data:www-data /path/to/uploads

  • July 16, 2020 at 10:55 pm #6088
    m
    mayberts
    Participant

    @stevland chown -R www-data:www-data /path/to/uploads fix the issue, many thanks for your help.

  • July 17, 2020 at 8:30 am #6094
    stevland
    Keymaster

    @mayberts I’m glad we figured it out. I added a note on the Troubleshooting page to help people in the future.

  • October 14, 2021 at 2:06 am #8463
    g
    gderichti
    Participant

    Ownership was the problem for me too. Running on Windows Server 2019 with IIS Version 10.0.17763.1

    In my case, changing the owner of the upload folder to the useraccount of the AppPool did it. You can see which systemuser and how to apply this to your folder here:
    iis – IIS_IUSRS and IUSR permissions in IIS8 – Stack Overflow

You must be logged in to reply to this topic.