Reputation: 2878
Currently I've a web app in Django that uploads files to a server folder in media/contracts/2018/5/3/myfile.pdf
the issue is that when the file is bigger than 2MB the uploaded file permissions.
-rw------- 1 root root 4664244 May 3 18:21 31ee8079-6ca9-4979-a0c1-d276b588e361.pdf
if the file is lower than 2MB gets.
-rwxrwxr-x 1 root root 2687931 May 3 14:14 8e498e49-ced8-45d2-af49-4234293d937c.pdf
my Urls.py for media_root is:
url(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT}),
Upvotes: 3
Views: 44
Reputation: 1645
you can read about how to set file upload permission in the django docs
in your settings.py you can set the permissions for uploaded files e.g.
FILE_UPLOAD_PERMISSIONS = 0644
If you don't have a FILE_UPLOAD_MAX_MEMORY_SIZE
set, files over 2.5MB will be directly streamed to the filesystem. This is what is causing the difference in permission between the two files.
Upvotes: 2