473,695 Members | 2,703 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 3604
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" onpropertychang e="alert(this.v alue)">
<input type="file" name="f1" onpropertychang e="this.form.my TextInput.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="visibili ty:hidden">
<input type="button" onclick="this.f orm.f1.click()" >
)
the filedialog you will get Access denied onsubmit
So...

--
Best Regards
Vidar Petursson
=============== ===============
Microsoft Internet Client & Controls MVP
=============== ===============
"Mr Gordonz" <pa**@mobius.ne t.au> wrote in message
news:uW******** ******@TK2MSFTN GP10.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.ne t.au> wrote in message
news:uW******** ******@TK2MSFTN GP10.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***********@s urfcontrol.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******** ********@TK2MSF TNGP09.phx.gbl. ..
"Mr Gordonz" <pa**@mobius.ne t.au> wrote in message
news:uW******** ******@TK2MSFTN GP10.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***********@s urfcontrol.com

Nov 17 '05 #4
In news:%2******** *******@TK2MSFT NGP12.phx.gbl,
Mr Gordonz <pa**@mobius.ne t.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.as p
downloadclientp cfile = "C:\theirwordfi le_containing_c reditcard_info. doc"
: 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******** ********@TK2MSF TNGP09.phx.gbl. ..
: "Mr Gordonz" <pa**@mobius.ne t.au> wrote in message
: news:uW******** ******@TK2MSFTN GP10.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.ne t.au> wrote in message
news:uW******** ******@TK2MSFTN GP10.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
1638
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
1330
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 prompt him to save it as a file. Here's the code.
3
2351
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 file type to the deployment project. After installation, double clicking a file with that...
1
2814
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 file type to the deployment project. After installation, double clicking a file with that...
4
7878
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
3003
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
2659
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 after about 300 files processed I get an error on Open function: “proc: Could not open file...
12
1418
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 project app How can i make "open with" association to display text with my project properly?
5
6202
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
8619
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8555
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9112
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8817
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5831
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4571
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2994
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
2
2258
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1970
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.