473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

File Open Dialog Box

Pai
Hello there,

I would like to open a "Chose File " dialog box using javascript.

I am using C# as the server side programming language.

I have tried <Input type="file" tag, and then "showModalDialog".

any help please.

Kind Regards,
Pai
Jul 20 '05 #1
6 25822
sp**@immunetolerance.org (Pai) writes:
I would like to open a "Chose File " dialog box using javascript. I am using C# as the server side programming language.
I have tried <Input type="file" tag, and then "showModalDialog".
That would be serverside, and will ofcourse not work on the client.
any help please.


If you have
<form id="foo">
<input type="file" name="bar">
</foo>
then in IE, you can activeate the file input by simulating
a click on the input: document.forms['foo'].elements['bar'].click()

It doesn't work in Mozilla or Opera.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
hello Irn,

Thanks for your reply, on the devdex.com forum.

Actually, when I click on tbe browse button <input type=file name=bar>.

I would like the selected file name to be inseted in a text field which
is placed next to the button.

I tried using a onclick event but it gets fired before the dialog box is
displayed so i cannot retrieve the name

<input type =text name=mytext>
<input type=file name=bar onclick='fn_test()'>.

function fn_text()
{
var my_name = '';
document.form1.mytext.value = document.form1.bar.click();
}

Any Suggestions please.

Kind Regards,
Pai.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3
Srikanth Pai <sp**@immunetolerance.org> writes:
hello Irn,
That would be LRN (my initials) :)
Thanks for your reply, on the devdex.com forum.
I don't know what the devdex.com forum is, this is a Usenet newsgroup
and it is not affiliated with devdex.com.
Actually, when I click on tbe browse button <input type=file name=bar>.
I would like the selected file name to be inseted in a text field which
is placed next to the button.
You can do this with the onchange handler on the file input. See below
I tried using a onclick event but it gets fired before the dialog box is
displayed so i cannot retrieve the name

<input type =text name=mytext>
<input type=file name=bar onclick='fn_test()'>.


<form ...>
<input type="text" name="mytext">
<input type="file" name="bar"
onchange="this.form.elements.mytext.value = this.value">
</form>

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4

Hello irn,

<input type="file">

does not have a event onchange.

Kind Regards,
Pai.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #5
In article <sm**********@hotpop.com>, Lasse Reichstein Nielsen <lr*@hotpop.com>
writes:
<form ...>
<input type="text" name="mytext">
<input type="file" name="bar"
onchange="this.form.elements.mytext.value = this.value">
</form>


Works in IE6.0, Opera 7, fails in Mozilla 1.4, Firebird 0.6.1and Netscape 7.02.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #6
hi************@aol.com (HikksNotAtHome) writes:
Works in IE6.0, Opera 7, fails in Mozilla 1.4, Firebird 0.6.1and
Netscape 7.02.


True. Since my first hint was IE only, I didn't say that the second
was only tested in IE6 and Opera 7. By mistake.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #7

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

Similar topics

4
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response ...
24
by: Kelly | last post by:
Hey all - I need a little more help. I don't quite know why my text file or form isn't closing. Short version - this program takes data entered into a textbox, user clicks Save button, Save...
2
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
17
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
3
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
5
by: charles | last post by:
I have a question about the file Open dialog box. I would like to be able to make the dialog box bigger by selecting the bottom right-hand corner and dragging/expanding the box. I am told by...
1
by: sunita | last post by:
Hiii I open a file download dialog from a modal dialog...From the file download dialog i can either save or open the file.. Is there a way i can let the modal dialog that opens the file download...
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.