File uploads

Forum to discuss the new web client version of Servoy.

File uploads

Postby derk.hulshof » Thu Feb 25, 2016 12:21 pm

Hi all,

I have a webcomponent with a file upload controller.
Through Client side Javascript I call a Servoy scope function/handler.

Now in the clientside I see the file is present picture1

On the serverside I have an object, but how can I read this object as an JSfile to put it in a serverside filesytemfolder.
When I use plugins.file.readFile() with or without paramets, it shows a fileChooseDialog.
Someone got some advice ?

Client side code:
HTML:
<input type="file" id="file" multiple onchange="startRead()" >
JS:
function startRead(evt) {
var _obj = document.getElementById('file');
var file = _obj.files[0];
if (file) {
console.log(file);
console.log("Name: " + file.name + " - Last Modified Date :" + file.lastModifiedDate);
var $scope = angular.element( _obj ).scope(); // handler to angularjs
$scope.handlers.uploadfile(file) // call scope function uploadFileTest
}
}
JS Handler in scopes
function uploadFileTest(_file, _formname) {
application.output('>> uploadfiles > ' )
application.output(_file)
// here use plugins.file to get the clientside file, if possible
}
derk.hulshof
 
Posts: 108
Joined: Tue Dec 03, 2013 9:18 am
Location: Netherlands

Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 4 guests