FishCustard Posted July 11, 2013 Posted July 11, 2013 (edited) Been setting up HAP+ today, and encountered various AJAX glitches. Server runs WS 2012 with IIS 8, ASP.NET 4.5. File uploads I get a 'File exists' message when I try to upload any file - the message has two spaces where the filename should be, implying a blank/null filename. If I click 'OK', I then get: Upload of has Failed! Value cannot be null. Parameter name: No File Attached This is the JSON response to the existence GET check: {"Actions":0,"Contents":null,"DateAccessed":null,"DateCreated":"20\/05\/2013 23:16:36","DateModified":null,"Extension":null,"Icon":"..\/images\/icons\/folder.png","Location":null,"Name":"teststudent","Permissions":{"AppendData":true,"CreateDirs":true,"Delete":true,"DeleteSubDirsOrFiles":true,"Execute":true,"FullControl":true,"ListDirs":true,"Modify":true,"ReadAttr":true,"ReadData":true,"ReadExAttr":true,"ReadExecute":true,"Traverse":true,"Write":true,"WriteAttr":true,"WriteData":true,"WriteExAttr":true},"Size":null,"Type":"File Folder"} I pastebinned the response to the POST request, see here: Value cannot be null.Parameter name: No File Attached! Creating folders When I create a folder I get a "SyntaxError: JSON.parse: unexpected end of data" message. The folder is in fact created, but HAP doesn't update to show this until I refresh the page. There's no response from the associated POST request to give here. Thanks for any help you might be able to give. Edited July 11, 2013 by FishCustard truncated post... weird
nickbro Posted July 11, 2013 Posted July 11, 2013 HAP+ hasn't been fully tested on Server 2012 yet. Looks like, from that, that jquery isn't working properly either, as it's not getting the data it needs to send to the server 1
nickbro Posted July 11, 2013 Posted July 11, 2013 I cannot replicate any of the above issues on my browsers (Chrome/Firefox 22/IE11 on Windows 8.1, Firefox 22/IE10 on Windows 7, Firefox 20,IE10 on Windows 8) 1
FishCustard Posted July 11, 2013 Author Posted July 11, 2013 (edited) I reinstalled HAP+ v9, but did not apply the v9.2 update, and things seem to be OK so far. To apply the 9.2 update the first time around, I just copied the 9.2 files into the HAP directory, overwriting what was there - is that the way to do it or am I being a twit? EDIT: Partial correction - the upload error appears to be resolved, but the folder creation error occurs exactly as before. Edited July 11, 2013 by FishCustard
FishCustard Posted July 11, 2013 Author Posted July 11, 2013 Further update: Replacing the copy of jQuery in the ~\Scripts folder with v1.8.3 downloaded from the official site fixed the 'unexpected end of data' messages. To anyone else who does this, I'd strongly recommend not using v1.9.x or greater, as they made some major changes which may well break HAP. v2.x.x is 'worse' in this regard, as it has simply no support for IE 6, 7 or 8.
nickbro Posted July 12, 2013 Posted July 12, 2013 Very odd, might be an IIS8 thing, will have to investigate that
nickbro Posted July 12, 2013 Posted July 12, 2013 Ok, I've tested my install, which runs jQuery 1.10.2 and IE8 operates normally, creates folders no problem at all, in both Compat mode and normal mode.
Paul-K Posted July 16, 2013 Posted July 16, 2013 Hi Nick, I am also getting the file upload issue since updating to 9.2, I am able to create folders but as soon as I try to upload a file using the uploader or drag and drop I get message saying the file exists and would I like to overwrite it, I click ok then I get another message saying: "Upload of has Failed! Value cannot be null.Parameter name: No File Attached". I am running HAP+ on Windows Web Server 2008 R2 and I have tried to upload files using, IE9, Google Chrome and Firefox. Any suggestions?
FishCustard Posted July 16, 2013 Author Posted July 16, 2013 Did you try replacing the included version of jQuery with v1.8.3?
Paul-K Posted July 17, 2013 Posted July 17, 2013 I have replaced the jquery.min.js file for v1.8.3 but still have the same issue. I have tested on my work machine using IE9 and it works correctly, my previous post was meant to say IE10 didn't work. I have also tested this morning in Chrome, Firefox and Safari, I am getting the same error in all except IE9 at the moment.
nickbro Posted July 17, 2013 Posted July 17, 2013 Did you try clearing your browser cache? Very odd issue as I code and test mainly against Firefox (not IE)
Paul-K Posted July 17, 2013 Posted July 17, 2013 @nickbro I cleared the cache on my work machine in all browsers and have restarted the server it's hosted on since upgrading, I have just done a clean install of firefox on my home PC as I hadn't installed in on that machine and am still seeing the errors shown in the attached images.
nickbro Posted July 17, 2013 Posted July 17, 2013 @Paul-K can you try the steps from this post: http://www.edugeek.net/forums/home-access-plus/119261-2-problems-home-access-plus-v9-2-a.html#post1026005
Paul-K Posted July 17, 2013 Posted July 17, 2013 @nickbro I have followed the steps provided in the link you gave, the attached image shows the results. If you would like me to debug further, I would be happy to help.
nickbro Posted July 17, 2013 Posted July 17, 2013 Ok, that didn't work, can you do the same steps but on line 973 instead and try again, only need firebug
Paul-K Posted July 17, 2013 Posted July 17, 2013 (edited) Ok, the upload progress bar starts to appear from the bottom of the screen then stops, the file doesn't upload but the errors that were coming up about replacing the file don't come up either. The attached images shows the debug info. Edited July 17, 2013 by Paul-K
nickbro Posted July 17, 2013 Posted July 17, 2013 1. Replace your ~/scripts folder with that from the full zip release 2. Apply the 9.3 upgrade again to upgrade the scripts again (the tree script is out of date there), this will reset myfiles/default.aspx 3. Go to edit ~/myfiles/default.aspx in notepad 4. Line 458 5. Change lines 458 to: console.log(this.File.name); this.FileName = $("#uploadfilesrandom").is(":checked") ? this.FormatFileName() : this.File.name; console.log(this.FileName); return;
Paul-K Posted July 17, 2013 Posted July 17, 2013 (edited) I have replaced the scripts folder from the full 9.0 Wednesday release and have applied version 9.2 again, I presume that is what you meant as I haven't seen a download for 9.3 yet? and I also applied the new baseline.css file. I have changed line 458 (this removes the if statement that was there) and I see the same results apart from there seem to be less errors in firebug Edited July 17, 2013 by Paul-K
nickbro Posted July 17, 2013 Posted July 17, 2013 Ok, that looks all ok. Undo what you just did Line 476: $("#upload-" + this.FileName.replace(/[\\'\. \[\]\(\)\-]/g, "_") + " .progressbar").progressbar({ value: 0 }); console.log(this.FileName); console.log(hap.common.formatJSONUrl('~/api/MyFiles/Exists/' + this.Path.replace(/\\/gi, "/").replace(/\.\.\/Download\//gi, "") + '/' + this.FileName)); $.ajax({
Paul-K Posted July 17, 2013 Posted July 17, 2013 I replaced the default.aspx file with the original from the 9.2 upgrade then changed line 477. The error messages have appeared again about overwriting the existing file and not able to upload with a value of null. Debug info attached.
nickbro Posted July 17, 2013 Posted July 17, 2013 Ok, that's not correct, try this please: this.Start = function() { this.FileName = $("#uploadfilesrandom").is(":checked") ? this.FormatFileName() : this.File.name; console.log(this.FileName); if (this.File.name.indexOf('.') == -1) { alert(hap.common.getLocal("myfiles/upload/folderwarning").replace(/\%/g, this.FileName)); uploads.pop(this); return false; } else if ("<%=AcceptedExtensions %>".toLowerCase().indexOf(this.FileName.substr(this.FileName.lastIndexOf('.')).toLowerCase()) == -1 && "<%=DropZoneAccepted %>" != "") { alert(this.File.name + " " + hap.common.getLocal("myfiles/upload/filetypewarning") + "\n\n <%=AcceptedExtensions %>"); uploads.pop(this); return false; } console.log(this.FileName); if(this.File.size > <%=maxRequestLength%>) { alert(this.File.name + " " + hap.common.getLocal("myfiles/upload/filesizewarning")); uploads.pop(this); return false; } console.log(this.FileName); $("#progresses").append(' ' + this.FileName + ''); $("#upload-" + this.FileName.replace(/[\\'\. \[\]\(\)\-]/g, "_") + " .progressbar").progressbar({ value: 0 }); console.log(this.FileName); console.log(hap.common.formatJSONUrl('~/api/MyFiles/Exists/' + this.Path.replace(/\\/gi, "/").replace(/\.\.\/Download\//gi, "") + '/' + this.FileName)); $.ajax({ type: 'GET', url: hap.common.formatJSONUrl('~/api/MyFiles/Exists/' + this.Path.replace(/\\/gi, "/").replace(/\.\.\/Download\//gi, "") + '/' + this.FileName), dataType: 'json', context: this, contentType: 'application/json', success: function (data) { if (data.Name == null || confirm(hap.common.getLocal("myfiles/upload/fileexists1") + " " + this.FileName + " " + hap.common.getLocal("myfiles/upload/fileexists2"))) this.ContinueUpload(this.FileName); else { $("#upload-" + this.FileName.replace(/[\\'\. \[\]\(\)\-]/g, "_")).remove(); if (uploads.length == 1) $("#uploadprogress").slideUp('slow'); uploads.pop(this); } }, error: hap.common.jsonError }); return true; };
Paul-K Posted July 17, 2013 Posted July 17, 2013 @nickbro I have just replaced the code above and all is working now. I have tested uploads and deleting from IE9/10, Google Chrome, Safari and Firefox using drag and drop and the upload button. Everything works perfectly in IE10, Chrome and Firefox, in IE9 and Safari the drag and drop feature doesn't appear to work it just opens up the file you are trying to upload, just thought I would let you know about those two. Thanks so much Nick for resolving that query so promptly.
nickbro Posted July 17, 2013 Posted July 17, 2013 Very odd, it shouldn't of made any difference. Can you try this code this.Start = function() { this.FileName = ($("#uploadfilesrandom").is(":checked") ? this.FormatFileName() : this.File.name) + ""; if (this.File.name.indexOf('.') == -1) { alert(hap.common.getLocal("myfiles/upload/folderwarning").replace(/\%/g, this.FileName)); uploads.pop(this); return false; } else if ("<%=AcceptedExtensions %>".toLowerCase().indexOf(this.FileName.substr(this.FileName.lastIndexOf('.')).toLowerCase()) == -1 && "<%=DropZoneAccepted %>" != "") { alert(this.File.name + " " + hap.common.getLocal("myfiles/upload/filetypewarning") + "\n\n <%=AcceptedExtensions %>"); uploads.pop(this); return false; } if(this.File.size > <%=maxRequestLength%>) { alert(this.File.name + " " + hap.common.getLocal("myfiles/upload/filesizewarning")); uploads.pop(this); return false; } $("#progresses").append(' ' + this.FileName + ''); $("#upload-" + this.FileName.replace(/[\\'\. \[\]\(\)\-]/g, "_") + " .progressbar").progressbar({ value: 0 }); console.log(hap.common.formatJSONUrl('~/api/MyFiles/Exists/' + this.Path.replace(/\\/gi, "/").replace(/\.\.\/Download\//gi, "") + '/' + this.FileName)); $.ajax({ type: 'GET', url: hap.common.formatJSONUrl('~/api/MyFiles/Exists/' + this.Path.replace(/\\/gi, "/").replace(/\.\.\/Download\//gi, "") + '/' + this.FileName), dataType: 'json', context: this, contentType: 'application/json', success: function (data) { if (data.Name == null || confirm(hap.common.getLocal("myfiles/upload/fileexists1") + " " + this.FileName + " " + hap.common.getLocal("myfiles/upload/fileexists2"))) this.ContinueUpload(this.FileName); else { $("#upload-" + this.FileName.replace(/[\\'\. \[\]\(\)\-]/g, "_")).remove(); if (uploads.length == 1) $("#uploadprogress").slideUp('slow'); uploads.pop(this); } }, error: hap.common.jsonError }); return true; }; The other code won't work unless you open the developer tools in the browser. Safari doesn't support drag and drop upload 1
Paul-K Posted July 17, 2013 Posted July 17, 2013 Changed the code as above but IE9 still doesn't work with drag and drop, I have tried this on my work machine with IE9 and by putting IE10 on my home machine into IE9 browser and document mode.
nickbro Posted July 17, 2013 Posted July 17, 2013 IE9 doesn't support drag and drop either, only came in IE10
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now