Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
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() {
...
@@ -353,11 +353,21 @@ $(function() {
/**
/**
* Uploads the specified file(s)
* Uploads the specified file(s)
*/
*/
function
readfiles
(
files
)
{
function
readfiles
(
file
)
{
var
formData
=
tests
.
formdata
?
new
FormData
()
:
null
;
//1 GB file limit
for
(
var
i
=
0
;
i
<
files
.
length
;
i
++
)
{
if
(
file
.
size
>
1024
*
1024
*
1024
)
{
if
(
tests
.
formdata
)
formData
.
append
(
'data'
,
files
[
i
]);
$
(
'#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
// now post a new XHR request
if
(
tests
.
formdata
)
{
if
(
tests
.
formdata
)
{
var
xhr
=
new
XMLHttpRequest
();
var
xhr
=
new
XMLHttpRequest
();
...
@@ -414,7 +424,7 @@ $(function() {
...
@@ -414,7 +424,7 @@ $(function() {
document
.
addEventListener
(
'drop'
,
function
(
e
)
{
document
.
addEventListener
(
'drop'
,
function
(
e
)
{
e
.
stopPropagation
();
e
.
stopPropagation
();
e
.
preventDefault
();
e
.
preventDefault
();
readfiles
(
e
.
dataTransfer
.
files
);
readfiles
(
e
.
dataTransfer
.
files
[
0
]
);
return
false
;
return
false
;
});
});
document
.
addEventListener
(
'dragover'
,
function
(
e
)
{
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