cancel
Showing results for 
Search instead for 
Did you mean: 

flex upload webscript problem

herrt
Champ in-the-making
Champ in-the-making
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
1 REPLY 1

stevereiner
Champ in-the-making
Champ in-the-making
couple things: you don't have the parent folder to upload into, also should have URLRequest  in member var not local.

You can look at the UploadFilesDelegate.as  in FlexSpaces

http://code.google.com/p/flexspaces/source/browse/trunk/FlexSpaces/src/org/integratedsemantics/flexs...

which uses this flexspaces uploadNew webscript

http://code.google.com/p/flexspaces/source/browse/trunk/?r=48#trunk/WebScripts/integratedsemantics/u...

downloads for flexspaces flex/actionscript in latest source section, webscripts in 0.7 / 0.8 webscript download:
http://forge.alfresco.com/projects/flexspaces/


Steve