Uploaded file is not valid for copy...

krozendaal

Verified User
Joined
Dec 2, 2020
Messages
8
Hi Guys,

I'm new to the forums and usually I'm able to solve problems using Google, but this issue seems very weird to me.

Whenever I upload an image through DA it says: Uploaded file is not valid for copy

When checking something deeper into the error logs it says:
2020:12:02-19:39:11: clean_dangerious_env_vars:Command::doFileManager: cleared dangerous variable: MAX_FILE_SIZE=10485760
2020:12:02-19:39:11: is_valid_upload_file: /home/tmp/screenshot.jpgvbUezU invalid. Must be owned by 'nobody' but is owned by 'root' uid=0
2020:12:02-19:39:11: Uploaded file '/home/tmp/screenshot.jpgvbUezU' is not valid for copy

The bold text seems to be the issue, but I can't figure out how to solve this. Any help would be greatly appreciated!!
 
extract archive via ssh,
remove content of /home/tmp/ in files from archive,
copress archive again,
try to restore again
 
What is the ownership of the file on your local machine from where you are uploading it? It is probably owned by root.

I just tested on my box, I created an empty file.img file, chown'd it to root, then used DA File Manager to try to upload it. Here is my error log:


2020:12:02-14:38:04: is_valid_upload_file: /home/tmp/file.imgW7RcPe invalid. Must be owned by 'nobody' but is owned by 'root' uid=0
2020:12:02-14:38:04: Uploaded file '/home/tmp/file.imgW7RcPe' is not valid for copy


Try changing the ownership on the file on the local machine and then uploading it.
 
Thanks for your replies!
However, I don't think this helps in this case.

I tried with different permissions on my local machine (also using a different pc), but that didn't seem to change anything. Both Windows and Mac. The weird thing is though, that I have another box, which works perfectly fine, with (in my eyes) the same permissions.

I also removed all contents of the /home/tmp directory, but this didn't change anything unfortunately.
 
look like your DA upload file with diradmin:root or something like root:root

try solution, or try reset permission by yourself in "/usr/local/directadmin/data/skins"

I think it relate to skin file,

on /home/tmp should look like this
drwxrwxrwt. root root
 
Last edited:
Thanks for your reply!

I tried resetting permissions like the help item twice, but that didn't solve the issue unfortunately... Restarting the VPS also doesn't solve the issue. I will look into the permissions for skins, but I don't think that will solve the issue. The issue persists in all skins (I tried multiple). The issue also occurs in both the file manager and the skin customizations sections.

Thanks already!
 
I don't know if this is allowed, but I'd like to bump this thread. Anyone who could help?
 
First welcome to DA and the forum.

Maybe some more info would help.
Are you trying to upload in the filemanager, some application, through php..
Is this a new server install?
What os and version are you on?
Is all of the system up to date?
Is it just this one file? what about other types and other sizes?
 
extract archive via ssh,
remove content of /home/tmp/ in files from archive,
copress archive again,
try to restore again
This is correct because file in archive like tar.gz has all permission preserved but it is weird that OP only mention about a single file image upload.
 
Hi Thanks for all replies!
Currently I'm running CentOS 7.9.2009
The complete system is up-to-date including DA. It happens for all files and especially within the DA dashboard. It doesn't happen for fileuploads in other locations (like WordPress for example).
 
Hi Thanks for all replies!
Currently I'm running CentOS 7.9.2009
The complete system is up-to-date including DA. It happens for all files and especially within the DA dashboard. It doesn't happen for fileuploads in other locations (like WordPress for example).

What is the permission for your current /home/tmp including the owner ?

One thing you could try is changing the tmp path in directadmin.conf use other path to troubleshoot:

Code:
mkdir -p /home/tmp2
/usr/local/directadmin/directadmin set tmpdir /home/tmp2

Don't forget to restart DA:

Code:
echo "action=directadmin&value=restart" >>/usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d2000

And try upload again the file.
 
Last edited:
Thanks for your reply. Unfortunately this didn't solve the issue:
2021:02:18-16:10:26: is_valid_upload_file: /home/tmp2/screenshot.jpgfpUHRh invalid. Must be owned by 'nobody' but is owned by 'root' uid=0

Ownership and permissions:
4 drwxrwxrwt. 2 root root 4096 Feb 18 15:01 tmp
0 drwxr-xr-x 2 root root 67 Feb 18 16:10 tmp2
 
Try chmod to nobody just for humour

I remember recently I played with API logo upload I had to chown the logo file to nobody like this:

chown nobody:nogroup filename.jpg

else it won't work and I will get the same error message like what the OP said.

But he said he has tried all kind of permissions.
 
Last edited:
I have the same problem occuring on one of my VPS machines. Also the provider has no clue how to fix this problem. Changing templates, repairing rights, different extentions, it does not matter, the result is the same "not valid for copy".

2021:02:19-22:25:14: clean_dangerious_env_vars:Command::doFileManager: cleared dangerous variable: MAX_FILE_SIZE=36700160
2021:02:19-22:25:14: is_valid_upload_file: /home/tmp/screen.pngom3RG7 invalid. Must be owned by 'nobody' but is owned by 'root' uid=0
2021:02:19-22:25:14: Uploaded file '/home/tmp/screen.pngom3RG7' is not valid for copy
 
It's too many reason,
Do you have "selinux" enable ?
check it with
Code:
sestatus

try disable it, and recheck again
 
Hello

Just had the issue on one of our shared hosting servers.

Could find this in the logs :
Code:
2022:11:13-12:41:37: tmpdir=../../../home/tmp does not appear to be a valid path in the directadmin.conf
2022:11:13-12:41:51: is_valid_upload_file: ../../../home/tmp/aboutus.jpgGM4Fcj is not a valid path
2022:11:13-12:41:51: Uploaded file '../../../home/tmp/aboutus.jpgGM4Fcj' is not valid for copy

Checking the directadmin.conf file the value was indeed anormal, replaced ../../../home/tmp with /home/tmp and uploads are possible again.
Now I checked in the backups of this server and the value is the same since years so I guess it used to work and then at some point some update of Directadmin cleared the code and it did not work anymore with that anormal path. (which was most likely autoconfigured on install).

Edit : checked on another old shared server, directadmin.conf dated Oct 2022 has the right value but an old backup of the file dated 2019 has the "tmpdir=../../../home/tmp" setting.
 
I had this problem because the filename had two dots before the extention. I removed one dot and it uploaded fine. DA v1.661.
 
Back
Top