Uploading Images - Refresh Directory

View: New views
2 Messages — Rating Filter:   Alert me  

Uploading Images - Refresh Directory

by mshowers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Looking for some help - I am using DWR (ajax) to upload image files to my web app.

The app is running on Tomcat v6.0.

I'm putting the files into a directory in WebContent\images or WebContent\images\<sub directories>

When I upload the images, I then want to display them on my page. heres the problem.

Even if I reload the page, the images will not appear on the page untill I go into the eclipse IDE and "REFRESH" the WebContent or Images directory.

Any suggestions as to how I can get around this?

Thanks!

Re: Uploading Images - Refresh Directory

by Christopher Schultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

mshowers,

On 11/10/2009 9:14 AM, mshowers wrote:
> Looking for some help - I am using DWR (ajax) to upload image files to my web
> app.
>
> The app is running on Tomcat v6.0.
>
> I'm putting the files into a directory in WebContent\images or
> WebContent\images\<sub directories>

Is that directory inside the deployment directory of your webapp? Don't
do that!

> When I upload the images, I then want to display them on my page. heres the
> problem[:]
>
> Even if I reload the page, the images will not appear on the page untill I
> go into the eclipse IDE and "REFRESH" the WebContent or Images directory.

What does REFRESH do in Eclipse? Does it re-deploy/reload the webapp? If
so, then you're hitting Tomcat's directory-caching behavior which makes
it difficult to put new files into the deployment directory while Tomcat
is running. Again, don't do that!

> Any suggestions as to how I can get around this?

Put your files somewhere else, and map a URI in your web application to
a servlet that can fetch the files (and/or directory listings) from that
other directory.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr50IoACgkQ9CaO5/Lv0PCPdQCcCRMlLLeREidPj+GY+1AW0Deb
GJkAn2l75eKsvM2lCRENCfJhO+3Od/mL
=VDng
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...