I am a novice to flex and I am trying to develop an application for uploading multiple image file along with progressbar for each upload. The datagrid holds the name of the file and the progressbar for each file when we select and add a file. When there is progress in file upload, it should be reflected in the progressbar as well. I have used filerefencelist to hold the collection of files and when i try to upload files it generates error "Null object"
My code :
private var initDG : ArrayCollection;
private var _arrUploadFiles:Array = new Array();
private var currentFile:FileReference;
private var currentFileIndex:Number = 0;
private var uploadErrors:Array = new Array();
private var _refAddFiles:FileReferenceList = new FileReferenceList();
// function in called when upload button is clicked
// uploading file to server
private function serverFileupload(event:Event):void
{
if( ! __serverSideScriptURL )
{
Alert.show("Server fileupload URL is missing. Unable to upload.");
return;
}
var request:URLRequest = new URLRequest();
request.url = __serverSideScriptURL;
request.method = URLRequestMethod.POST;
currentFile = new FileReference();
currentFile = _arrUploadFiles[currentFileIndex];
currentFile.addEventListener(IOErrorEvent.IO_ERROR, uploadIoErrorHandler);
currentFile.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, uploadCompleteHandler );
currentFile.upload(request, "FileUpload", false);
}
Can anyone help me out with the solution to this problem?