Created
March 8, 2013 13:14
-
-
Save vmattila/5116378 to your computer and use it in GitHub Desktop.
This gist includes test code for a possible bug in co-operation between Developr theme and https://github.com/blueimp/jQuery-File-Upload
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<!-- Developr modernizer --> | |
<script type="text/javascript" src="/js/libs/modernizr.custom.js"></script> | |
<!-- Developr jQuery 1.8.2 --> | |
<script type="text/javascript" src="/js/libs/jquery-1.8.2.min.js"></script> | |
<!-- @see https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin , UI Widget comes from the full jquery ui js --> | |
<script type="text/javascript" src="/javascript/datepicker/jquery-ui-1.9.1.custom.min.js"></script> | |
<script type="text/javascript" src="/javascript/jquery.fileupload.js"></script> | |
<script type="text/javascript" src="/javascript/jquery.iframe-transport.js"></script> | |
<!-- Developr theme setup --> | |
<script type="text/javascript" src="/js/setup.js"></script> | |
</head> | |
<body> | |
<form action="" method="POST"> | |
<input type="file" name="file" id="fileField" /> | |
<div id="progressBlock" style="display: none;"> | |
<div>File is being uploaded, please wait...</div> | |
</div> | |
<script type="text/javascript"> | |
$(function() { | |
$('#fileField').fileupload({ | |
"dataType": 'json', | |
"url": "/upload-test.php", | |
"paramName": "f", | |
done: function(e, data) { | |
$('#fileField').show(); | |
$('#progressBlock').hide(); | |
if (data.result.success) { | |
alert("Upload Success"); | |
} else { | |
alert('Upload failed: ' + data.result.error); | |
} | |
}, | |
send: function(e, data) { | |
$('#fileField').hide(); | |
$('#progressBlock').show(); | |
} | |
}); | |
}); | |
</script> | |
</form> | |
</body> | |
</html> |
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
<?php | |
// Simple server-side file to respond to file upload request | |
// Content-Type is text/html even the content is json. | |
// @see https://github.com/blueimp/jQuery-File-Upload/wiki/Setup (under header "Content-Type" negotiation) | |
Header("Content-Type: text/html"); | |
echo json_encode(array('success' => true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment