Connecting Tech Pros Worldwide Forums | Help | Site Map

Opening File Dailog Box using javascript

Viks
Guest
 
Posts: n/a
#1: May 21 '06
Hi everyone,

I am beginner at javascript.One of the web
applications that i am currently developing,requires to upload file
from the client side to the server.The condition being that the file
dailog box(normal windows file dailog box) on the client side should
open in a specific directory only and should filter out files with a
specific extension.Moreover the relative path of the selected file
should be converted into UNC path and passed on to the server.

I am not very sure whether javascript can possibly get a hook to the
file dailog box of the underlying OS(Windows in my case).I tried
finding some ideas over the net,but none looked convincing.

Is this possible in javascript?,if not, is there any way that i can
acheive this.

Any suggestion would be very valuable.


Randy Webb
Guest
 
Posts: n/a
#2: May 21 '06

re: Opening File Dailog Box using javascript


Viks said the following on 5/21/2006 6:37 AM:[color=blue]
> Hi everyone,
>
> I am beginner at javascript.One of the web
> applications that i am currently developing,requires to upload file
> from the client side to the server.[/color]

Simple so far.
[color=blue]
> The condition being that the file dailog box(normal windows file
> dailog box) on the client side should open in a specific directory
> only and should filter out files with a specific extension.[/color]

That you can't do.
[color=blue]
> Moreover the relative path of the selected file should be converted
> into UNC path and passed on to the server.[/color]

The path to the file will always be an absolute full path in Windows so
no conversion needed. You just read the .value of the input:

<input type="file" onchange="alert(this.value)">

But, why does it matter where the file is located on the PC?
[color=blue]
> I am not very sure whether javascript can possibly get a hook to the
> file dailog box of the underlying OS(Windows in my case).I tried
> finding some ideas over the net,but none looked convincing.[/color]

You can't. It is a security restriction.
[color=blue]
> Is this possible in javascript?[/color]

No.
[color=blue]
> if not, is there any way that i can acheive this.[/color]

I hope not, for the security issues involved.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Viks
Guest
 
Posts: n/a
#3: May 22 '06

re: Opening File Dailog Box using javascript


Thanx for the reply.

Closed Thread