472,334 Members | 2,333 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

Button to launch "Open File" Dialogue

Hi all,

I want to put a button on a page, and when the user clicks it, the standard
Windows "Open File" dialogue box opens, and the user can browse/select a
file on their PC. Having selected a file, the user clicks Open, and I then
want to capture the file path and name in a string variable. Finally, I
want to upload the file to the server.

BUT: I don't want to use an <input type="file"> control.

Can this be done?

Cheers,

MG
Nov 17 '05 #1
5 3457
Hi

input type="file" is the only way... well maybe...
http://fileup.softartisans.com/default.aspx?PageID=122
you can read the contents of the input no problem but you cant set it
And why capture it in a variable as its already in the input....

How to read its value
<input type="file" name="f1" onpropertychange="alert(this.value)">
<input type="file" name="f1" onpropertychange="this.form.myTextInput.value =
this.value">
And if you have the input type=file hidden and use regular button to popup
( // Example
<input type="file" name="f1" style="visibility:hidden">
<input type="button" onclick="this.form.f1.click()">
)
the filedialog you will get Access denied onsubmit
So...

--
Best Regards
Vidar Petursson
==============================
Microsoft Internet Client & Controls MVP
==============================
"Mr Gordonz" <pa**@mobius.net.au> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I want to put a button on a page, and when the user clicks it, the standard Windows "Open File" dialogue box opens, and the user can browse/select a
file on their PC. Having selected a file, the user clicks Open, and I then want to capture the file path and name in a string variable. Finally, I
want to upload the file to the server.

BUT: I don't want to use an <input type="file"> control.

Can this be done?

Cheers,

MG

Nov 17 '05 #2
"Mr Gordonz" <pa**@mobius.net.au> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I want to put a button on a page, and when the user clicks it, the standard Windows "Open File" dialogue box opens, and the user can browse/select a
file on their PC. Having selected a file, the user clicks Open, and I then want to capture the file path and name in a string variable. Finally, I
want to upload the file to the server.

BUT: I don't want to use an <input type="file"> control.


Curiosity: why not? You've just described the functionality of <input
type="file">!
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com
Nov 17 '05 #3
Hi John,

I guess you could call it pig-headedness on my part! I like to think of it
as "because the mountain was there". It is not a big deal, but I would like
to know one way or another if it is possible - and if it is possible, how is
it done.

I strongly suspect it can't be done (at least, not without great
difficulty) - but if someone can prove me wrong, go right ahead - I would
thank you for it!

Cheers,

MG

"John Saunders" <jo***********@surfcontrol.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
"Mr Gordonz" <pa**@mobius.net.au> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I want to put a button on a page, and when the user clicks it, the standard Windows "Open File" dialogue box opens, and the user can browse/select a
file on their PC. Having selected a file, the user clicks Open, and I then want to capture the file path and name in a string variable. Finally, I
want to upload the file to the server.

BUT: I don't want to use an <input type="file"> control.


Curiosity: why not? You've just described the functionality of <input
type="file">!
--
John Saunders
Internet Engineer
jo***********@surfcontrol.com

Nov 17 '05 #4
In news:%2***************@TK2MSFTNGP12.phx.gbl,
Mr Gordonz <pa**@mobius.net.au> typed:
: Hi John,
:
: I guess you could call it pig-headedness on my part! I like to think
: of it as "because the mountain was there". It is not a big deal, but
: I would like to know one way or another if it is possible - and if it
: is possible, how is it done.

As others have suggested, the only way is with a signed plug-in (applet,
activeX, etc..). It's a security issue on why you (the server) cannot
specify the path and file to download (automatically).

sillyexample.asp
downloadclientpcfile = "C:\theirwordfile_containing_creditcard_info.d oc"
: I strongly suspect it can't be done (at least, not without great
: difficulty) - but if someone can prove me wrong, go right ahead - I
: would thank you for it!

No luck, I can prove it can't be done. Anything for that?

Don
:
:
:
: "John Saunders" <jo***********@surfcontrol.com> wrote in message
: news:%2****************@TK2MSFTNGP09.phx.gbl...
: "Mr Gordonz" <pa**@mobius.net.au> wrote in message
: news:uW**************@TK2MSFTNGP10.phx.gbl...
:: Hi all,
::
:: I want to put a button on a page, and when the user clicks it, the
:: standard Windows "Open File" dialogue box opens, and the user can
:: browse/select a file on their PC. Having selected a file, the user
:: clicks Open, and I then want to capture the file path and name in a
:: string variable. Finally, I want to upload the file to the server.
::
:: BUT: I don't want to use an <input type="file"> control.
:
: Curiosity: why not? You've just described the functionality of <input
: type="file">!
Nov 17 '05 #5
Thanks to all who have responded to my question. It is pretty clear that
using an <input type="file"> control is by far my best option (as I
suspected).

Don - unfortunately, proving me right (ie: it can't be done without great
difficulty) doesn't get you anything, except my thanks for putting the issue
to rest!

Cheers,

MG

"Mr Gordonz" <pa**@mobius.net.au> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I want to put a button on a page, and when the user clicks it, the standard
Windows "Open File" dialogue box opens, and the user can browse/select a
file on their PC. Having selected a file, the user clicks Open, and I then
want to capture the file path and name in a string variable. Finally, I
want to upload the file to the server.

BUT: I don't want to use an <input type="file"> control.

Can this be done?

Cheers,

MG

Nov 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Hareth | last post by:
When VS2003 is installed : I can open Form1.cs w/ windows "open with" contextmenu, then it opens the file w/ notepad & it works fine but...
3
by: Terry Olsen | last post by:
I followed the information in a previous thread, but i'm having problems. I have a couple dropdownlists and a submit button on my form. The user...
3
by: Mark.V.Sullivan | last post by:
I have encountered the same problem another posted about several months ago. Unfortunately, there was no result posted on the old thread. I will...
1
by: Paul Sullivan | last post by:
I have encountered the same problem another posted about several months ago. Unfortunately, there was no result posted on the old thread. I will...
4
by: Wayne | last post by:
How do I get rid of the generic Windows "Open File - Security Warning" that appears when I try to open a database that resides on another PC on my...
1
by: bhushan11 | last post by:
hello sir i am searching in your site but i dont get how to place question about visual c++. so i am post this vc++ question in .net , sorre...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in...
12
by: kimiraikkonen | last post by:
Hi, I have small project which opens text files via inside the project but i want to associate this app for every text file. To have a test, if i...
5
by: Stefano Tonello | last post by:
Hi all, I need to call windows' "open with" dialog from my C# windows form application. After the user selects application, control must return to...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.