This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
body { | ||
font: 12px Arial; | ||
margin: 20px auto; | ||
text-align: center; | ||
width: 260px; | ||
} | ||
|
||
form { | ||
margin: 20px 0; | ||
} | ||
|
||
input[type="submit"] { | ||
margin: 20px 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Ezdz example</title> | ||
<link rel="stylesheet" href="../dist/jquery.ezdz.min.css"> | ||
<link rel="stylesheet" href="css/styles.css"> | ||
</head> | ||
<body> | ||
<h1>Ezdz example</h1> | ||
<p>Png or Jpeg, max 600x400</p> | ||
|
||
<form action="" method="post" enctype="multipart/form-data"> | ||
<input type="file" accept="image/png, image/jpeg"> | ||
|
||
<input type="submit"> | ||
</form> | ||
|
||
<script src="http://code.jquery.com/jquery.min.js"></script> | ||
<script src="../dist/jquery.ezdz.min.js"></script> | ||
<script> | ||
$('[type="file"]').ezdz({ | ||
text: 'drop a picture', | ||
validators: { | ||
maxWidth: 600, | ||
maxHeight: 400 | ||
}, | ||
reject: function(file, errors) { | ||
if (errors.mimeType) { | ||
alert(file.name + ' must be an image.'); | ||
} | ||
|
||
if (errors.maxWidth) { | ||
alert(file.name + ' must be width:600px max.'); | ||
} | ||
|
||
if (errors.maxHeight) { | ||
alert(file.name + ' must be height:400px max.'); | ||
} | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |