set file permissions (2774) via perl upload script
Posted on 2014-04-17
I have a script that uploads a file via HTTP on Apache and AIX.
The script works well.
Only issue is that the uploaded file is created with permissions 0644.
I need permissions 2774, note that 2 is Set GID. This is required by the 3rd party app that then takes the file after upload and imports it. When set only to 0644 the 3rd party app cannot read the file.
The file is an xml formatted file uploaded from a supplier.
I have tried adding the following command to the upload script but it does not make the required change, no error is returned.
my $mode = 2774;
system "chmod $mode, $filename";
Directory and file owner & group permissions are set to; nobody.users
The upload directory is not in the path of the Apache web service so security is not the first issue here.
Any assistance is appreciated.
Thanks in advance.