You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by 123shyam <sh...@gmail.com> on 2008/12/16 13:26:01 UTC

Re: File Chooser dialog needed

Thanks for the response.

I have a similar requirement for upload tooo. I want to make a Browse
button, which accepts folder locations, and uploads all the files in that
location. uploading the data from the file is fine... i can handle
but how to create a button, which accepts folder locations of both client
system and server system
?


Jeremy Thomerson-5 wrote:
> 
> You simply can't do this in web apps.  You don't choose where to write
> something to - you don't have access to write anything to the user's
> computer.  All you can do is give the user a file to download, and the
> browser will automatically ask them for what folder they want to save it
> to.  For this, search Nabble or Google for "DownloadLink".
> 
> Give the user a link (DownloadLink) to a file.  They click it.  The
> browser
> opens your dialog for you.
> 
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> On Fri, Nov 7, 2008 at 11:48 AM, Shyam Narayanan <
> Shyam_Narayanan@mindtree.com> wrote:
> 
>> Thanks for your reply.
>>
>> My main aim of this task is to download an item into the directory user
>> selects.
>>
>> So need to open a file dialog to help user choose a directory and then
>> from
>> it get the path user chose, so as to proceed with my
>> download.
>>
>> So as you can imagine for this, i have a browse kindoff button for user
>> to
>> chose a directory and as it closes, need to display the path selected in
>> a
>> text field.
>> The button as well as textfield stand on a wicket page. Just the action
>> of
>> opening a file browser is what i want.
>>
>> I am very new to wicket. Could you pls explain more on what i would have
>> to
>> do to open such a dialog nd then get the path selected ?
>>
>> A code example would be appreciated.
>>
>> Thanks
>> ________________________________________
>> From: Jeremy Thomerson [jeremy@wickettraining.com]
>> Sent: Friday, November 07, 2008 9:01 PM
>> To: users@wicket.apache.org; shyam.narayanan@gmail.com
>> Subject: Re: File Chooser dialog needed
>>
>> Swing classes are not in the same heirarchy as Wicket's and the two are
>> not
>> made to work together.  What you need is to add an <input type="file"
>> ....
>> /> and a FileUpload (Wicket class).  However, you can't have a user just
>> select a directory from their browser - this is a limitation of web apps.
>> Besides, what could you possibly do with that directory path once you had
>> it?  You don't have access to their local computer....
>>
>> Depending on what you're doing, if you really had to do something with a
>> directory, you may have to <horror-music-starts> use an applet
>> </horror-music>.
>> Hope this helps.
>>
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>> On Fri, Nov 7, 2008 at 5:04 AM, 123shyam <sh...@gmail.com>
>> wrote:
>>
>> >
>> > Hello,
>> >
>> > I am working on wicket. I need to open a filechooser dialog or a file
>> open
>> > =
>> > dialog (like we have in JFileChooser).
>> >
>> > I am currently unable to implement it from my wicket page. All I want
>> is
>> a
>> > =
>> > file chooser dialog showing only directories , user chooses nd I get
>> back
>> > t=
>> > he path selected.
>> >
>> > I tried to call a JFielChosser (sinwg) thorught wicket but there seems
>> to
>> > b=
>> > e some problem, the dialog cmes in a different location first time and
>> in
>> > t=
>> > he center of the 2nd time onwards, I guess the modality is wrong. The
>> > JFile=
>> > Chooser needs a Component object type as its parent. But I am unable to
>> > pas=
>> > s it from thewicket class. It cannot be cast to a Component or Window.
>> > Kindly help me out on this.
>> >
>> > Thanks,
>> > Shyam
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/File-Chooser-dialog-needed-tp20378500p20378500.html
>> > Sent from the Wicket - User mailing list archive at Nabble.com.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> > For additional commands, e-mail: users-help@wicket.apache.org
>> >
>> >
>>
>> This message (including attachment if any) is confidential and may be
>> privileged. If you have received this message by mistake please notify
>> the
>> sender by return e-mail and delete this message from your system. Any
>> unauthorized use or dissemination of this message in whole or in part is
>> strictly prohibited. E-mail may contain viruses. Before opening
>> attachments
>> please check them for viruses and defects. While MindTree Limited
>> (MindTree)
>> has put in place checks to minimize the risks, MindTree will not be
>> responsible for any viruses or defects or any forwarded attachments
>> emanating either from within MindTree or outside.
>>
>> Please note that e-mails are susceptible to change and MindTree shall not
>> be liable for any improper, untimely or incomplete transmission.
>>
>> MindTree reserves the right to monitor and review the content of all
>> messages sent to or from MindTree e-mail address. Messages sent to or
>> from
>> this e-mail address may be stored on the MindTree e-mail system or else
>> where.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/File-Chooser-dialog-needed-tp20378500p21032127.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: File Chooser dialog needed

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Again, you can't do this in a standard HTML form.  For something like this,
you will need to use something like an applet.  Put simply, the browser does
not give you folder locations, and even if it did, your server couldn't list
or grab files from the client's folder.  And, the browser won't
automatically upload an entire folder of anything.  HTML has a file input
only for files - not directories.  Allowing anything different would be a
big security risk.

As far as letting them choose where to save it on the server - why would you
do this?  You can accomplish this by creating or using some sort of browse /
select component, but this is typically a bad idea - why do you want to give
a user access to your server file system over a webapp?  It might be good to
go back and look at your real requirements and evaluate what MUST be done,
and then how best to accomplish it.  (note - there may be certain use cases
where you do need to do this, but they are very rare, and almost
non-existent on a public app - which this may not be)

Anyway, hope this helps.


On Tue, Dec 16, 2008 at 6:26 AM, 123shyam <sh...@gmail.com> wrote:

>
> Thanks for the response.
>
> I have a similar requirement for upload tooo. I want to make a Browse
> button, which accepts folder locations, and uploads all the files in that
> location. uploading the data from the file is fine... i can handle
> but how to create a button, which accepts folder locations of both client
> system and server system
> ?
>
>
> Jeremy Thomerson-5 wrote:
> >
> > You simply can't do this in web apps.  You don't choose where to write
> > something to - you don't have access to write anything to the user's
> > computer.  All you can do is give the user a file to download, and the
> > browser will automatically ask them for what folder they want to save it
> > to.  For this, search Nabble or Google for "DownloadLink".
> >
> > Give the user a link (DownloadLink) to a file.  They click it.  The
> > browser
> > opens your dialog for you.
> >
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> > On Fri, Nov 7, 2008 at 11:48 AM, Shyam Narayanan <
> > Shyam_Narayanan@mindtree.com> wrote:
> >
> >> Thanks for your reply.
> >>
> >> My main aim of this task is to download an item into the directory user
> >> selects.
> >>
> >> So need to open a file dialog to help user choose a directory and then
> >> from
> >> it get the path user chose, so as to proceed with my
> >> download.
> >>
> >> So as you can imagine for this, i have a browse kindoff button for user
> >> to
> >> chose a directory and as it closes, need to display the path selected in
> >> a
> >> text field.
> >> The button as well as textfield stand on a wicket page. Just the action
> >> of
> >> opening a file browser is what i want.
> >>
> >> I am very new to wicket. Could you pls explain more on what i would have
> >> to
> >> do to open such a dialog nd then get the path selected ?
> >>
> >> A code example would be appreciated.
> >>
> >> Thanks
> >> ________________________________________
> >> From: Jeremy Thomerson [jeremy@wickettraining.com]
> >> Sent: Friday, November 07, 2008 9:01 PM
> >> To: users@wicket.apache.org; shyam.narayanan@gmail.com
> >> Subject: Re: File Chooser dialog needed
> >>
> >> Swing classes are not in the same heirarchy as Wicket's and the two are
> >> not
> >> made to work together.  What you need is to add an <input type="file"
> >> ....
> >> /> and a FileUpload (Wicket class).  However, you can't have a user just
> >> select a directory from their browser - this is a limitation of web
> apps.
> >> Besides, what could you possibly do with that directory path once you
> had
> >> it?  You don't have access to their local computer....
> >>
> >> Depending on what you're doing, if you really had to do something with a
> >> directory, you may have to <horror-music-starts> use an applet
> >> </horror-music>.
> >> Hope this helps.
> >>
> >>
> >> --
> >> Jeremy Thomerson
> >> http://www.wickettraining.com
> >>
> >> On Fri, Nov 7, 2008 at 5:04 AM, 123shyam <sh...@gmail.com>
> >> wrote:
> >>
> >> >
> >> > Hello,
> >> >
> >> > I am working on wicket. I need to open a filechooser dialog or a file
> >> open
> >> > =
> >> > dialog (like we have in JFileChooser).
> >> >
> >> > I am currently unable to implement it from my wicket page. All I want
> >> is
> >> a
> >> > =
> >> > file chooser dialog showing only directories , user chooses nd I get
> >> back
> >> > t=
> >> > he path selected.
> >> >
> >> > I tried to call a JFielChosser (sinwg) thorught wicket but there seems
> >> to
> >> > b=
> >> > e some problem, the dialog cmes in a different location first time and
> >> in
> >> > t=
> >> > he center of the 2nd time onwards, I guess the modality is wrong. The
> >> > JFile=
> >> > Chooser needs a Component object type as its parent. But I am unable
> to
> >> > pas=
> >> > s it from thewicket class. It cannot be cast to a Component or Window.
> >> > Kindly help me out on this.
> >> >
> >> > Thanks,
> >> > Shyam
> >> > --
> >> > View this message in context:
> >> >
> >>
> http://www.nabble.com/File-Chooser-dialog-needed-tp20378500p20378500.html
> >> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> > For additional commands, e-mail: users-help@wicket.apache.org
> >> >
> >> >
> >>
> >> This message (including attachment if any) is confidential and may be
> >> privileged. If you have received this message by mistake please notify
> >> the
> >> sender by return e-mail and delete this message from your system. Any
> >> unauthorized use or dissemination of this message in whole or in part is
> >> strictly prohibited. E-mail may contain viruses. Before opening
> >> attachments
> >> please check them for viruses and defects. While MindTree Limited
> >> (MindTree)
> >> has put in place checks to minimize the risks, MindTree will not be
> >> responsible for any viruses or defects or any forwarded attachments
> >> emanating either from within MindTree or outside.
> >>
> >> Please note that e-mails are susceptible to change and MindTree shall
> not
> >> be liable for any improper, untimely or incomplete transmission.
> >>
> >> MindTree reserves the right to monitor and review the content of all
> >> messages sent to or from MindTree e-mail address. Messages sent to or
> >> from
> >> this e-mail address may be stored on the MindTree e-mail system or else
> >> where.
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/File-Chooser-dialog-needed-tp20378500p21032127.html
>  Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Jeremy Thomerson
http://www.wickettraining.com