PDA

View Full Version : refresh the upload image


mohan
09-12-2003, 08:46 AM
Hi Antun,
i am able to upload the file (image ) to the lps through jsp and some helper classes. Also i am generating the xml file which contain the reference to the image file .And also i am able to display the the uploaded image in the lzx by using the dataset.(<dataset name="dset1" src="http://localhost:8080/mall/test.xml" autorequest="true" type="http"/>) But my problem is if once agian i upload the the image in the lzx,( agian by clicking on the upload button)
that recently uploaded image is not displaying in the lzx file (old image is displaying ) .For that i have to refresh the lzx file to get the newer uploaded image .
For this, Is there any solution to load the image dynamically when i click on the upload button in the lzx?
(instead of "applydata" ,is there any attribute which load the file dynamically with out refreshing the lzx file.

Thanks
mallesh

antun
09-12-2003, 09:18 AM
Hey Mallesh

If the url of the image is retrieved through a dataset:


<dataset name="dset1"
src="http://localhost:8080/mall/test.xml"
autorequest="true" type="http"/>


... you could redo the request in script:


dset1.doRequest();


Anything that's bound to that data (such as the URL of an image) will be refreshed. However, the trick here is to know when the data is changed. If the Laszlo app can know when the user started uploading an image, then you could start doing the request every few seconds or so until the image has finished uploading.

You could do this by setting a delegate to be called every few seconds or so. See here on how to do that:

http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=138&highlight=lzdelegate

You could use the dataset's ondata event to cancel that delegate, so they don't start to overlap, if one takes longer than the other.

A way around this problem is to have a placeholder image, that shows up when a download starts. Then if the user clicks on that image, do the request then.

-Antun