Environment:
Apache webserver running locally for development purposes on a Ubuntu Linuxmint 17 workstation with Firefox. Menu item generates a jQueryUI dialog with contents being a Webix UI File Uploader component.
Code for File Uploader component as follows:
var urlstr = "/includes/upload.php";
var uploader = webix.ui({
container:"popup", width: 400, align: 'center', minHeight: 150, borderless: true,
view: "form", name: "uploadform", id: "uploadform", rows: [
{ view: "uploader", name:"ufiles", id: "ufiles", value: "Select File", multiple: false, autosend: false, upload: urlstr },
{ view:"button", label: "Send file", id: 'submitbutton', click: function(e) {
$$("ufiles").send(function(response) { //sending files
$$("ufiles").onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var response = this.responseText;
alert('done, use firebug to see response');
}
}
var file_id = $$("ufiles").files.getFirstId(); //getting the ID
var fileobj = $$("ufiles").files.getItem(file_id).file; //getting file object
filename - fileobj.name;
console.log(filename);
alert(response.status)
})
}}
]
});
You will see various additional snippets of code in inside the fileuploader, to demonstrate the lengths that I have gone to in the last 8 hours, in order to find a solution to my problem.
I could write my own low level XHR file upload component (and have) but this defeats the object of using Webix and in any event, I cannot invoke my XHR component from the Submit Button click or by any other means from within or attached to the File Uploader component.
I have scoured your documentation at length for advice and a solution (especially the Doc. on Manipulation of Files).
The file will upload without problem but I cannot obtain ANY response from the “send” function. That is, contrary to your documentation, the “response” contains nothing or there is no action of any sort invoked as a Callback to the Send activity. This is despite the fact that Firebug response from the POST activity produces any form of valid result I choose using my PHP Upload handler or using your upload.php - string, filename, error, JSON etc.
I am also not able to attach any event to the Upload.
I am fully aware of how sensitive the XhtmlRequest can be and for me in this environment I venture to suggest it is not working.
An extended point about my environment. My overall Webix environment of which my File Uploader is one small component is the administration system for my CMS system called Cliqon Lite. The administration system operates within an iFrame which is invoked as part of a TinyBox2 window. This means that if the FileUploader component is using an iFrame, there could be some confusion as to which Document represents the Parent of that iFrame. This would account for the problem that I am suffering. You would need to be more precise in your Code and look for the The Immediate Parent as opposed to A Parent.