Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
936f2c49
Commit
936f2c49
authored
Aug 13, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Server-side (LMS) checking of uploaded filesize
parent
d19244c4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
lms/djangoapps/courseware/module_render.py
+10
-1
No files found.
lms/djangoapps/courseware/module_render.py
View file @
936f2c49
...
...
@@ -336,11 +336,20 @@ def modx_dispatch(request, dispatch=None, id=None, course_id=None):
- id -- the module id. Used to look up the XModule instance
'''
# ''' (fix emacs broken parsing)
# TODO: Should be in settings.py
MAX_UPLOAD_FILE_SIZE
=
4
*
1000
*
1000
# 4 MB
# Check for submitted files
p
=
request
.
POST
.
copy
()
if
request
.
FILES
:
for
inputfile_id
in
request
.
FILES
.
keys
():
p
[
inputfile_id
]
=
request
.
FILES
[
inputfile_id
]
inputfile
=
request
.
FILES
[
inputfile_id
]
if
inputfile
.
size
>
MAX_UPLOAD_FILE_SIZE
:
file_too_big_msg
=
'Submission aborted! Your file "
%
s" is too large (max size:
%
d MB)'
%
\
(
inputfile
.
name
,
MAX_UPLOAD_FILE_SIZE
/
(
1000
**
2
))
return
HttpResponse
(
json
.
dumps
({
'success'
:
file_too_big_msg
}))
p
[
inputfile_id
]
=
inputfile
student_module_cache
=
StudentModuleCache
.
cache_for_descriptor_descendents
(
request
.
user
,
modulestore
()
.
get_item
(
id
))
instance
=
get_module
(
request
.
user
,
request
,
id
,
student_module_cache
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment