7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich}).use('cssbutton', 'uploader', 'node', 'console', function(Y) {
ec749fdeacb8e11cb7a9dd6dcebd1538b953059eAllen Rabinovich// Force Flash uploader
ec749fdeacb8e11cb7a9dd6dcebd1538b953059eAllen Rabinovich// Y.Uploader = Y.UploaderFlash;
ec749fdeacb8e11cb7a9dd6dcebd1538b953059eAllen Rabinovich// Force HTML5 uploader
ec749fdeacb8e11cb7a9dd6dcebd1538b953059eAllen Rabinovich// Y.Uploader = Y.UploaderHTML5;
ec749fdeacb8e11cb7a9dd6dcebd1538b953059eAllen Rabinovich myuploader = new Y.Uploader({ multipleFiles: true,
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich uploadURL: "http://www.yswfblog.com/upload/simpleupload.php",
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich swfURL: "assets/flashuploader.swf?t=" + Math.random(),
7211944935145abdba8a3ea3b17621ec264d8e21Allen Rabinovich tabElements: {from: "#pageTitle", to: "#uploadButton"}
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich Y.one("#pageTitle").setContent("Using uploader: HTML5");
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich var dropArea = Y.Node.create('<div id="droparea" style="width:500px;height:150px;background:#cccccc;">Drop some files here!</div>');
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich myuploader.set("dragAndDropArea", dropArea);
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich Y.one("#pageTitle").setContent("Using uploader: Flash");
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich myuploader.after("fileListChange", function (ev) {
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich Y.each(myuploader.get("fileList"), function (value) {
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich out.append("<div id='" + value.get("id") + "'>" + value.get("name") + " | " + 0 + "%</div>");
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich postVars[value.get("id")] = {filename: value.get("name"), filesize: value.get("size")};
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich myuploader.set("postVarsPerFile", postVars);
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich myuploader.on("uploadprogress", function (ev) {
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich out.one("#" + ev.file.get("id")).setContent(ev.file.get("name") + " | " + ev.percentLoaded + "%");
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich myuploader.on("uploadcomplete", function (ev) {
ec749fdeacb8e11cb7a9dd6dcebd1538b953059eAllen Rabinovich out.one("#" + ev.file.get("id")).setContent(ev.file.get("name") + " | " + "Finished!");
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich out.one("#" + ev.file.get("id")).append("<p>DATA:<br> " + ev.data + "</p>");
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich myuploader.on("totaluploadprogress", function (ev) {
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich Y.one("#totalpercent").setContent("Total upload progress: " + ev.percentLoaded);
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich myuploader.on("alluploadscomplete", function (ev) {
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich Y.one("#totalpercent").setContent("<p>Upload complete!</p>");
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich Y.one("#uploadButton").on("click", function () {
ec749fdeacb8e11cb7a9dd6dcebd1538b953059eAllen Rabinovich Y.one("#triggerButton").on("click", function () {
70837a7c5871ea73a84ab67d8c34fcd9d2daa31cAllen Rabinovich Y.one("body").prepend("Neither HTML5 nor Flash uploaders can be used on this system");