473,516 Members | 3,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3580
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
1625
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 after installing VS2005, "open with" doesnt function correctly. If I try to open with notepad, it forces an open to VS2005
3
1316
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 selects choices from the lists and clicks the submit button. The app then places the data requested into a string variable. I want to send this data out to the client and have the save dialog...
3
2337
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 let the original message text stand and ask if anyone can help me with this.. "I have created a deployment project for a .NET program which opens a file with a custom extension. I have added the...
1
2802
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 let the original message text stand and ask if anyone can help me with this.. "I have created a deployment project for a .NET program which opens a file with a custom extension. I have added the...
4
7867
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 home network? This is not the annoying macro security warning - I have my macro security set to low. The warning I am describing only appears when a database on another machine is opened.
1
2986
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 about that i am working on visual c++ lang. but i nave some problem. Linking... LINK : fatal error LNK1104: cannot open file "ProfUIS223md.lib" Error executing link.exe.
0
2641
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 the format “file.gz”. I created a script which should decompress, open and then delete nearly 400 files. To do so I use "open FILEPT, "zcat $filename|"". In the beginning the script works fine, but...
12
1399
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 right click on a text file -then "open with" -my application... but my app's text area(textbox,where the text data is loaded into. ) is opened blank, nothing is displayed except a general view of my...
5
6184
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 me (I have to launch directly the process). I found this solution: http://www.codeproject.com/KB/shell/openwith.aspx but it's not good for me since it will execute the process directly.
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7581
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.