Hi there
I'm creating a custom component and just need to be advised in terms of how I can get it to work with ABMUploadHandler and thus trap the Page_FileUploaded sub.
Working Examples (update)
Both the ABMUpload and ABMFileInput components have a public property called UploadHandler, logging this returns "abmuploadhandler"
So far, I have been able to trap the change event which returns the selected files.
So I guess following the same suit, I could read the selected files, save them and perhaps use Ajax to upload to the server. I guess I could use PHP but there is already functionality to upload files with ABMUploadHandler which calls Page_FileUploaded, which is my ultimate goal.
Thanks in advance for your help.
Regards
Mashy
I'm creating a custom component and just need to be advised in terms of how I can get it to work with ABMUploadHandler and thus trap the Page_FileUploaded sub.
Working Examples (update)
- File Chooser- https://www.b4x.com/android/forum/threads/abmaterial-attempting-a-file-chooser.95388/#content
- Profile Picture File Chooser - https://www.b4x.com/android/forum/t...ofile-picture-file-chooser.95394/#post-602691
Both the ABMUpload and ABMFileInput components have a public property called UploadHandler, logging this returns "abmuploadhandler"
So far, I have been able to trap the change event which returns the selected files.
B4X:
Dim onchange As String = $"$('#${compid}files').change(function(){
var ${compid}files = document.getElementById('${compid}files');
var ${compid}list = [];
for (var x = 0; x < ${compid}files.files.length; x++) {
var eachName = ${compid}files.files[x].name;
${compid}list.push(eachName);
};
var output = JSON.stringify(${compid}list);
this.value=null;
b4j_raiseEvent('${ABMComp.ID}_changed', {'value':output});
});"$
So I guess following the same suit, I could read the selected files, save them and perhaps use Ajax to upload to the server. I guess I could use PHP but there is already functionality to upload files with ABMUploadHandler which calls Page_FileUploaded, which is my ultimate goal.
Thanks in advance for your help.
Regards
Mashy
Last edited: