I am working on an AngularJS 1.x project with an ASP.NET Web API 2.2 backend. I would normally handle this in the normal Single-Page Application (SPA) fashion. However I have receive some strange requests to do... popup dialogs (remember... window.showModalDialog() ).
I have got most of this working, however I have run into something odd. When passing the shared object ('sharedObject' between popup dialog and Angular SPA) 'window.dialogArguments' back to the Angular front end, it tends to only love key/value pairs. It does not want an array of any sort.
I want to pass an array of file objects or a 'FileList' back to the AngularJS front end through 'windows.dialogArguments'. I want to do this from an input that follows:
<input id="upldDcmnts"
name="upldDcmnts"
type="file"
multiple />
I have tried the following most straightforward approach:
window.dialogArguments.UploadFiles =
document.getElementById( "UpldDcmnts" ).files;
... and appended them to the FormData object in an Angular controller as follows:
var formData = new FormData();
formData.append( "upload_files", sharedObject.UploadFiles );
This fails with the following error form the F12 Debugger for Internet Explorer (IE) 11:
TypeError: Permission denied
If some one could, please explain how I can pass an array of file objects from the upload input to the angular front end through 'window.dialogArguments'.
The form setup appears to be correct. It has a 'name' attribute and...
enctype="multipart/form-data"
NOTE: I understand this is unconventional, however the customer is a long time Windows user and won't have it any other way (please believe I have tried to talk them into another way and have become mean spirited in the process...). I understand a SPA modal can be used and looks prettier but it does not matter in this case.