Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<!--do you have html5 and file reader? -->
<input type="file" name="photo_1"/>
<input type="file" name="photo_2"/>
<script type="text/javascript">
var _min_width = 470;
var _min_height = 330;
var _which;
var _fyle_type;
var allowed_types = new Array('image/png','image/jpg','image/jpeg');
if (typeof(FileReader) === 'function'){
$('input[type="file"]').on('change', function(e) {
    var file = e.target.files[0];
    
    if (!in_array(file.type,allowed_types) || file.length === 0){
        notify("You must select a valid image file!",false,false); 
        return;
    }
   
    if(file.size > 3145728 /*3MB*/){
        notify("ouhef",false,false); 
        return;
    }
    notify_destroy();
    
    var reader = new FileReader();
    reader.onload = fileOnload;
    reader.readAsBinaryString(file);
   
});
function fileOnload(e) {
    var img = document.createElement('img');
    img.src = e.target.result;
       
    img.addEventListener('load', function() {
        if(img.width < _min_width || img.height < _min_height ){
        notify("kjwnef",false,false); 
        return;
        }
       
        $.ajax({
            type:'post',
            data:{file:this},
            url:'/upload/upload_photos'
         });
        
    });
}
}
</script>
</body>
</html>
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers