[flexcoders] FileReference upload passing parameters in URLRequest

2007-10-28 Thread letterpigeon
Hi all,
 
I'm having this strange problem while uploading file in flex using
FileReference, that even though I set the the request attribute on the
flex side, and I verified that before I call fileRef.upload, the
URLRequest object has all the attributes I set in its data property.
 But when the request arrived on the java servlet side, the
httprequest contains no attributes at all.  Below is the code snippet
that I'm using to perform the upload, this processUpload method is
called after the user has browsed for a file, then hit upload so I'm
only registering the COMPLETE event here.  fileRef is a global
variable of type FileReference in the enclosing file.
private function processUpload(func:Function):void

{

fileRef.addEventListener(Event.COMPLETE, func);


var request:URLRequest = new
URLRequest(FileImportConfigurationSource.HOST_PORT_CONTEXT +
/FileUploadServlet);

var params:URLVariables = new URLVariables();


//Read file header data from UI input

var client:FIClient = clientList.selectedItem as FIClient;

var mnemonic:String = mnemonicList.selectedLabel;


uploadFileId = UIDUtil.createUID().toString();

params.uploadFileId = uploadFileId;

params.transmissionId = testing;


request.data = params;


fileRef.upload(request);

}

Anyone spot any wrongdoing in the above code?  Thanks.

Ban



Re: [flexcoders] FileReference upload passing parameters in URLRequest

2007-10-28 Thread Abdul Qabiz
Note sure, but you might need to set the method in URLRequest.

request.method = URLRequestMethod.POST;

-abdul

On 10/29/07, letterpigeon [EMAIL PROTECTED] wrote:

   Hi all,

 I'm having this strange problem while uploading file in flex using
 FileReference, that even though I set the the request attribute on the
 flex side, and I verified that before I call fileRef.upload, the
 URLRequest object has all the attributes I set in its data property.
 But when the request arrived on the java servlet side, the
 httprequest contains no attributes at all. Below is the code snippet
 that I'm using to perform the upload, this processUpload method is
 called after the user has browsed for a file, then hit upload so I'm
 only registering the COMPLETE event here. fileRef is a global
 variable of type FileReference in the enclosing file.
 private function processUpload(func:Function):void

 {

 fileRef.addEventListener(Event.COMPLETE, func);

 var request:URLRequest = new
 URLRequest(FileImportConfigurationSource.HOST_PORT_CONTEXT +
 /FileUploadServlet);

 var params:URLVariables = new URLVariables();

 //Read file header data from UI input

 var client:FIClient = clientList.selectedItem as FIClient;

 var mnemonic:String = mnemonicList.selectedLabel;

 uploadFileId = UIDUtil.createUID().toString();

 params.uploadFileId = uploadFileId;

 params.transmissionId = testing;

 request.data = params;

 fileRef.upload(request);

 }

 Anyone spot any wrongdoing in the above code? Thanks.

 Ban

  




-- 
-abdul
---
http://abdulqabiz.com/blog/
---