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
d920e718
Commit
d920e718
authored
Aug 19, 2012
by
kimth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AJAX permits multiple file upload
parent
588444c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
common/lib/xmodule/xmodule/js/src/capa/display.coffee
+10
-8
No files found.
common/lib/xmodule/xmodule/js/src/capa/display.coffee
View file @
d920e718
...
...
@@ -157,17 +157,19 @@ class @Problem
fd
=
new
FormData
()
# Sanity check of file size
file_too_large
=
false
abort_submission
=
false
max_filesize
=
4
*
1000
*
1000
# 4 MB
@
inputs
.
each
(
index
,
element
)
->
if
element
.
type
is
'file'
if
element
.
files
[
0
]
instanceof
File
if
element
.
files
[
0
].
size
>
max_filesize
file_too_large
=
true
alert
'Submission aborted! Your file "'
+
element
.
files
[
0
].
name
+
'" is too large (max size: '
+
max_filesize
/
(
1000
*
1000
)
+
' MB)'
fd
.
append
(
element
.
id
,
element
.
files
[
0
])
else
for
file
in
element
.
files
if
file
.
size
>
max_filesize
abort_submission
=
true
alert
'Submission aborted! Your file "'
+
file
.
name
'" is too large (max size: '
+
max_filesize
/
(
1000
*
1000
)
+
' MB)'
fd
.
append
(
element
.
id
,
file
)
if
element
.
files
.
length
==
0
abort_submission
=
true
alert
'Submission aborted! You did not select any files to submit'
fd
.
append
(
element
.
id
,
''
)
else
fd
.
append
(
element
.
id
,
element
.
value
)
...
...
@@ -185,7 +187,7 @@ class @Problem
else
alert
(
response
.
success
)
if
not
file_too_large
if
not
abort_submission
$
.
ajaxWithPrefix
(
"
#{
@
url
}
/problem_check"
,
settings
)
check
:
=>
...
...
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