Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 23rd, 2004, 05:32 AM
Registered User
 
Join Date: Nov 2003
Location: coimbatore, tN, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to show a File Dialog using Javascript

Dear All,
         how to show a file dialog "Save As" window for selecting the location and to write a .txt file on the specified location without using ActiveXObject.. scripting.filesystemobject and MsComDlg

URGENT

Thanks in advance

Reply With Quote
  #2 (permalink)  
Old June 23rd, 2004, 06:38 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Try:

document.execCommand("saveas",false,"c:\\where\\yo u\\want\\to\\save\\it\\to.txt");

HTH,

Snib

<><
Reply With Quote
  #3 (permalink)  
Old October 14th, 2007, 10:45 PM
Authorized User
 
Join Date: Sep 2006
Location: pune, Maharastra, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi All,

How to open file dialog box using java script.

with help of <input type="file" /> I can open the file dialog box..

but my requirement is to open the file dialog box on click of link?

Pls help me out solving this problem..



sheetal
Reply With Quote
  #4 (permalink)  
Old October 16th, 2007, 04:38 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hi SheetM!!
Hope this will help you

<script>
function openFileOption()
{
document.getElementById("file1").click();
}
</script>

<input type="file" id="file1" style="display:none">
<a href="#" onclick="openFileOption();return;">open File Dialog</a>




Cheers :)

vinod
Reply With Quote
  #5 (permalink)  
Old October 16th, 2007, 04:54 AM
Authorized User
 
Join Date: Sep 2006
Location: pune, Maharastra, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vindo..

I am using the JSF framework.. So I am using the JSF component for file dialog

<hx:fileupload id="fileupload1"
        styleClass="fileupload" accept="image/*"
        binding="#{photoGalleryEditPhotoBean.photoName}"></hx:fileupload>

It same as could as the <Input type="file"/>

I wrote the same javascript to display the dialog on click of link.

When the form is submited then the selected file path is getting cleared.

Bcoz of this I am not able to proceed the futher..

Do you know wt could be the reason..

sheetal
Reply With Quote
  #6 (permalink)  
Old October 16th, 2007, 05:14 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Yes, it's a security thing. Otherwise you could arrange for a file to be uploaded without the user's full knowledge.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #7 (permalink)  
Old July 9th, 2008, 06:25 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please check
http://www.ardentedge.com/pr_fd.htm


Reply With Quote
  #8 (permalink)  
Old July 9th, 2008, 06:28 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please check
http://www.ardentedge.com/pr_fd.htm

Reply With Quote
  #9 (permalink)  
Old May 28th, 2011, 05:41 AM
Registered User
 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default saving in different format

Quote:
Originally Posted by Snib View Post
Try:

document.execCommand("saveas",false,"c:\\where\\yo u\\want\\to\\save\\it\\to.txt");

HTH,

Snib

<><
thanks this code is working fine. But it only gives the oppertunity to save either in .txt format or a webpage format.
what if i want to save it in other formats like .doc,.docx,.pdf etc.....
Reply With Quote
  #10 (permalink)  
Old June 15th, 2011, 11:59 PM
Registered User
 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to select & browse files with dialog box

hihi! I'm new in javascripts. I wanna to find out how to select & browse files in all browser as I doing my projects. I need help on this thanks. Did anyone know how?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LinkButton should not show javascript in Statusbar savan_thakkar ASP.NET 1.0 and 1.1 Professional 2 August 27th, 2006 06:25 AM
hide/show header with javascript crmpicco Javascript How-To 2 April 10th, 2006 03:45 AM
Javascript Confirm dialog difficulty ayrton Javascript 1 May 20th, 2005 03:34 AM
Modal Dialog (javascript & ASP.NET) nestor082 ASP.NET 1.0 and 1.1 Basics 2 March 30th, 2005 08:38 PM



All times are GMT -4. The time now is 05:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.