Hi. I've got a Flex app that communicates with a Java servlet to
enable image file uploads. The user clicks in a Flex DataGrid row's
button to select an image file and then clicks an Upload button to
send the file to the server. I'd like to have the image in the row
updated to use the one the user just uploaded to the server; however,
even when I do a refresh on the page, the old image is showing. The
only way I'm able to get the image updated is to empty my browser's
cache and reload the page.

The file upload is done via an itemRenderer that contains an
<mx:Image> tag, along with the buttons and a read-only TextInput
control that displays the filename. In a Script block of the
itemRenderer, the following code loads the image for each row. The
getFilename() method simply checks to ensure the row has an image, or
returns an empty string.
                                                                                
                override public function set data(value:Object):void {
super.data = value;
                                                                                
                        try {
  imgPhoto.load("../fpauto/uploads/" + data.image.filename);
}
catch (error:IOError){
  // Ignore.
}

}

Is there a way to have Flex update the row right after the upload to
show the latest image? Thank you. 

Reply via email to