Topic: Webserver down yet plupload still reports success on upload?
Hi,
I've found an odd error when using plupload and the html5 runtime. Haven't tested other runtimes yet. If a user selects a file to upload but the webserver is down plupload still makes all the callbacks as if the file had uploaded correctly (i.e. UploadProgress callback reports 100% and FileUploaded callback gets called). The browser itself reports that the post failed in the consel before any of this happens, but then the callbacks are made as if everything was normal. The Error callback is not called most importantly.
I've tested this on Chrome and Firefox so far with the same result. Has anyone else seen anything like this? Am I missing something in my code?
Here is my simple test case index.html file:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Simple plupload test</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
</script>
<!-- Load source versions of the plupload script files -->
<script type="text/javascript" src="src/javascript/plupload.js"></script>
<script type="text/javascript" src="src/javascript/plupload.html5.js"></script>
<script type="text/javascript">
$(function() {
var pluploader = new plupload.Uploader({
runtimes : 'html5',
browse_button : 'uploadfiles_id',
max_file_size : '10mb',
url : '/file_upload'
});
pluploader.bind('Init', function(up, params) {
console.log("Current runtime environment: " + params.runtime);
});
pluploader.init();
pluploader.bind('FilesAdded', function(up, files) {
console.log("Starting upload.");
up.refresh();
up.start();
});
pluploader.bind('UploadProgress', function(up, file) {
console.log("Progress: " + file.name + " -> " + file.percent);
});
pluploader.bind('Error', function(up, err) {
console.log("Error: " + err.code + ", Message: " + err.message +
(err.file ? ", File: " + err.file.name : ""));
});
pluploader.bind('FileUploaded', function(up, file, response) {
console.log("File uploaded, File: " + file.name + ", Response: " + response.response);
});
});
</script>
</head>
<body style="">
<div id="uploadfiles_id" style="width:100px; background-color:red">
<p>Upload</p>
</div>
</body>
</html>