Alfresco Flex AIR Upload File Basic Authentication Error
See the wiki page for the Alfresco Upload Webscripts, but with these files, I was unable to upload files without always getting the Basic Authentication popup window always appearing. The key was adding the 'alf_ticket' request parameter to the URL string:
fileRef = new FileReference(); //instantiated earlier
urlVars = new URLVariables();
urlVars.title = 'my title';
urlVars.desc = 'my description';
urlReq = new URLRequest();
urlReq.method = URLRequestMethod.POST;
urlReq.data = urlVars;
//ticket was returned after logging in
urlReq.url = "http://<<myserver>>/alfresco/service/site/upload?alf_ticket="+this.ticket;
//
fileRef.upload(urlReq, 'file');
Login code...
var svc : HTTPService = new HTTPService();
svc.resultFormat = 'e4x'
svc.addEventListener(ResultEvent.RESULT, onLogin);
svc.url = "http://<<myserver>>/alfresco/service/api/login";
var params : Object = {};
params.u = 'bsmith';
params.pw = 'password';
svc.send(params);
protected function onLogin(event:ResultEvent):void
{
this.ticket = XML(event.result).text().toString();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment