In Flex, the way to upload files is by using the upload method of the FileReference Object.

fileRef.upload(request);

fileRef.upload(request, “file”); //file string just gives a string var name to the file object to be uploaded

However, we might also need to pass some request variables during the file upload. The way to do so is by creating a URLVariables object and assigning the object into FileReference.data

var reqVars:URLVariables = new URLVariables(”name=value”);

request.data = reqVars;