Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d6d5f655
authored
Feb 06, 2013
by
Dányi Bence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: client-side filesize validation added
parent
ed96496e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
one/static/cloud.js
+15
-5
No files found.
one/static/cloud.js
View file @
d6d5f655
...
...
@@ -353,11 +353,21 @@ $(function() {
/**
* Uploads the specified file(s)
*/
function
readfiles
(
files
)
{
var
formData
=
tests
.
formdata
?
new
FormData
()
:
null
;
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
if
(
tests
.
formdata
)
formData
.
append
(
'data'
,
files
[
i
]);
function
readfiles
(
file
)
{
//1 GB file limit
if
(
file
.
size
>
1024
*
1024
*
1024
)
{
$
(
'#upload-zone'
).
hide
();
$
(
'#upload-error'
).
show
();
$
(
'#upload-error-size'
).
show
();
setTimeout
(
function
(){
$
(
'#upload-zone'
).
show
();
$
(
'#upload-error'
).
hide
();
$
(
'#upload-error-size'
).
hide
();
},
3000
);
return
;
}
var
formData
=
tests
.
formdata
?
new
FormData
()
:
null
;
formData
.
append
(
'data'
,
file
);
// now post a new XHR request
if
(
tests
.
formdata
)
{
var
xhr
=
new
XMLHttpRequest
();
...
...
@@ -414,7 +424,7 @@ $(function() {
document
.
addEventListener
(
'drop'
,
function
(
e
)
{
e
.
stopPropagation
();
e
.
preventDefault
();
readfiles
(
e
.
dataTransfer
.
files
);
readfiles
(
e
.
dataTransfer
.
files
[
0
]
);
return
false
;
});
document
.
addEventListener
(
'dragover'
,
function
(
e
)
{
...
...
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