473,320 Members | 2,147 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,320 software developers and data experts.

Creating a browse button.

vikas251074
198 100+
How can I create browse button in ASP using JavaScript. Onclicking browse button, an explorer windows should open from which user should select file for attachment.

Thanks and regards,
Vikas
Jun 2 '08 #1
4 2518
hsriat
1,654 Expert 1GB
How can I create browse button in ASP using JavaScript. Onclicking browse button, an explorer windows should open from which user should select file for attachment.

Thanks and regards,
Vikas
Add an input dynamically and provide type=file to it. Or use this code.
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('file_div').innerHTML = '<input type="file" name="myfile" />';
where file_div is the id of the div where you want to add this.
Jun 2 '08 #2
vikas251074
198 100+
Add an input dynamically and provide type=file to it. Or use this code.
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('file_div').innerHTML = '<input type="file" name="myfile" />';
where file_div is the id of the div where you want to add this.

Thanks very much

Regards,
Vikas
Jun 2 '08 #3
vikas251074
198 100+
Hello sir,
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. document.getElementById('file_div').innerHTML = '<input type="file" name="myfile" />';
  3. </script>
What does this line do? Whether it creates browse button or anything else.
When I add above in HTML part of programme, it does nothing. What is the reason sir.

Thanks and regards,
Vikas
Jun 3 '08 #4
hsriat
1,654 Expert 1GB
Hello sir,

What does this line do? Whether it creates browse button or anything else.
When I add above in HTML part of programme, it does nothing. What is the reason sir.

Thanks and regards,
Vikas
Of course it adds a browse button (technically:file input) as you asked.

But it has one requirement. You need to have a div in your page with id="file_div".

So where you want this button to be added, add <div id="file_div"></div> in your HTML.

innerHTML dynamically adds HTML to an element of the document. Google for its purpose, you will understand it.

And use type="text/javascript" instead of language="javascript"
Jun 3 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
1
by: Chris Lasher | last post by:
Hello, I'm trying to write a tool to scrape through some of the Ribosomal Database Project II's (http://rdp.cme.msu.edu/) pages, specifically, through the Hierarchy Browser....
5
by: Fred | last post by:
Hi I am searching for a module, that would allow me to call files by using a 'browse' button. Is there any uniform module for browsing files, or is there a special module for *.txt files? Thanks...
5
by: Ron Brennan | last post by:
Good afternoon. The entire task that I'm trying to achieve is to allow a user to browse and upload multiple files simultaneously, hiding the Browse button of <input> tags of type="file" and...
3
by: oopaevah | last post by:
I want to have a separate button which invokes the "browse" button on an input type=file. In internet explorer the following code works ok, in firefox nothing happens. All I do is call click()...
4
by: developing | last post by:
Hi All, I have a browse button that the user can click to select a file. The button then fetches the file path. This is all working fine except my boss wants some add functionality. I need it to...
1
by: ipa | last post by:
Hello, I made one browse button in asp form to store files. Now i am facing the problem is when i am editing that asp form. In that i call browse button during edit.but during edit, that...
5
by: NasirMunir | last post by:
I need some help for creating a button that can allow the users to browse to a location and upload a file. I am new to VB, and any help would be greatly appreciated.
4
by: Beb | last post by:
I have created a browse button to upload files, that part works fine but after I navigate to the file and collect the file grab it, there is no why for me to submit it for upload. How do I direct...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.