Notifications
Clear all
6 Forums 829 Topics 3,280 Posts 9 Online 3,047 Members

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

13 Posts
4 Users
0 Reactions
248 Views
Posts: 6
Topic starter
(@mayberts)
Member
Joined: 6 years ago

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


12 Replies
Posts: 4
 esbd
(@esbd)
Member
Joined: 6 years ago

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


Reply
Posts: 6
Topic starter
(@mayberts)
Member
Joined: 6 years ago

I found a workaround, I uploaded our image using WINscp


Reply
Posts: 1185
Admin
(@stevland)
Member
Joined: 10 years ago

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.


Reply
Posts: 6
Topic starter
(@mayberts)
Member
Joined: 6 years ago

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


Reply
Posts: 1185
Admin
(@stevland)
Member
Joined: 10 years ago

@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?


Reply
Posts: 6
Topic starter
(@mayberts)
Member
Joined: 6 years ago

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


Reply
Posts: 6
Topic starter
(@mayberts)
Member
Joined: 6 years ago

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$


Reply
Posts: 1185
Admin
(@stevland)
Member
Joined: 10 years ago

@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?


Reply
Posts: 1185
Admin
(@stevland)
Member
Joined: 10 years ago

@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


Reply
Posts: 6
Topic starter
(@mayberts)
Member
Joined: 6 years ago

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


Reply
Posts: 1185
Admin
(@stevland)
Member
Joined: 10 years ago

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


Reply
Posts: 1
(@gderichti)
Member
Joined: 6 years ago

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


Reply
Share: