AnsweredAssumed Answered

flex upload webscript problem

Question asked by herrt on Feb 17, 2009
Latest reply on Feb 17, 2009 by stevereiner
hi

im working on a flex front-end for an alfresco repository.
my little app is able to login and to get some folder content from the repository.
for my login and getFolderContent function i am using the alfresco flex sdk like this:


private function login():void
{
var url:String = "http://192.168.0.3:8080/alfresco/service/api/login";
var webScript:WebScriptService = new WebScriptService(url, WebScriptService.GET, onLoginSuccess, onLoginFailure, false);
var params:Object = new Object();
params.u = "admin";
params.pw = "admin";
webScript.execute(params);
}


public function getFolderContent(folder:String):void
{
var url:String = _alfServerURL+"service/sample/folder/"+folder+"?format=atom";
var webScript:WebScriptService = new WebScriptService(url, WebScriptService.GET, onGetDeskXMLSuccess, onGetDeskXMLFailure, true);
webScript.ticket = _alfTicket;
webScript.execute();
}

which works quite well.

now i want to implement an upload function but i am not sure how to do that the right way…

private function onSelect(evt:Event):void
{
var url:String = FILE_UPLOAD_URL + "?alf_ticket=" + _alfTicket;
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;
fileRef.upload(request);
}

which ends in a 401 HTTP error…

so i am wondering how to send the credentials to the alfresco web service.
any pointers ?


thank you,
philipp

Outcomes