• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Set default value for Struts file tag

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a Struts 1 application, where the user is able to upload a file of his choice through a Struts File control. The basic functionality works fine. I would like to enhance the feature in these two ways:

1. When the user clicks on the Browse button to upload a file, it would default to a specific folder location (For eg: c:\temp). I tried using the value attribute to set folder path, but it is ignored.

2. I also want it to list only files of a certain type (for eg: *.jpg). I check for file type after it is chosen and display an error message if it is not what is expected, but ideally would like to preempt it. When testing on IE 7, I am able to type in *.txt, and restrict file types that way... but on IE 8, the field is not editable.

Any suggestions? This is a secure intranet application with a login procedure etc., so there aren't any security concerns or violations. Thanks much for any and all suggestions!
 
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maya,

How you are planning to access the client's PC? From My point of View its not possible to open a specific folder from clients machine.


Regards
Jatan
 
Maya Raman
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Jatan,

I do not really want to access the client's pc. We have a hard coded path that would exist on all the intranet machines, and I would like the file explorer to open at that folder. I do not need the contents of the folder or anything like that. If that specific folder does not exist, it can default to whatever it usually uses.

Thanks,
Maya

 
jatan bhavsar
Ranch Hand
Posts: 300
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Maya,

File explorer will open at the clients machine. But still if you find any solution please let me know i am also interested to know.
From my point of view its not possible.

Regards
Jatan
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know about Struts, but when I use Firefox and repeatedly access a page which does file uploads, I find that Firefox remembers the folder that I last uploaded a file from, and starts from that folder the next time.

Of course that isn't under your control, but it does suggest that you don't need to try implementing the requirement yourself (which you can't anyway).
 
Maya Raman
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul and Jatan for your responses. Do you know if there is a way to at least restrict file types?
 
What are you doing in my house? Get 'em tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic