473,830 Members | 2,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Directory Dialog Box

Is there a way in Javascript to bring up dialog boxes for both opening and
then also saving a file?

Jul 23 '05 #1
12 35596
In article
<96************ *************** ***@localhost.t alkaboutprogram ming.com>,
rp*****@nospam. indy.rr.com enlightened us with...
Is there a way in Javascript to bring up dialog boxes for both opening and
then also saving a file?


Please clarify the question.
What file is being opened?
What do you mean by 'dialog box'? A prompt? A window? A "browse" button? A
modal dialog window?

What do you mean by "and then also"? Same button/prompt/whatever does both
tasks? A dialog box for both tasks, but the dialog box is not the same
object?
--
--
~kaeli~
Is it true that cannibals don't eat clowns because they
taste funny?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
This is going to be a file compare program. I just need to have the
standard windows open file dialog box open so the user can select the
file, i will use this twice so they can choose the two file's to be
compared. After the compare i want the standard windows save as box to
appear so they can save the results file.

Jul 23 '05 #3
> I just need to have the
standard windows open file dialog box open so the user can select the
file, I will use this twice so they can choose the two files to be
compared. After the compare I want the standard windows save as box to appear so they can save the results file.


In general, Javascript cannot read or write files from the local
filesystem.

You can create an "open" dialog by creating an <input type="file"> form
element and could probably open it by invoking its onclick method
(though I haven't tried it). But I don't think that the content of the
selected file is available to Javascript (again, I haven't tried).
Similarly a server-side implementation can trigger a "save as" and/or
"open with" dialog by returning content of a type that the browser
cannot handle natively, but I don't believe there is a way for
Javascript to generate such content.

I would be curious to know if anyone can suggest a way of doing this.

--Phil.

Jul 23 '05 #4
I dont plan on having the browser open and doing this in an html page, i
guess i was assuming you could run javascript by itself like vbscript

Jul 23 '05 #5
In article <4d7cc225a92f00 1ec7ced86507ade bc5
@localhost.talk aboutprogrammin g.com>, rp*****@nospam. indy.rr.com enlightened
us with...
This is going to be a file compare program. I just need to have the
standard windows open file dialog box open so the user can select the
file, i will use this twice so they can choose the two file's to be
compared. After the compare i want the standard windows save as box to
appear so they can save the results file.


The file input type prompts for a file on button click.
<input type="file">

For saving the results, I believe this would work. (Windows / MSIE only?)
document.execCo mmand('SaveAs') ;

If this is running on a PC, you may want to look into using an HTA with
Windows Script Host. You don't tend to run into as many security problems
that way. You get more stuff to play with, too. Check out FileSystemObjec t.

HTH
--
--
~kaeli~
Abdicate (v.), to give up all hope of ever having a flat
stomach.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #6
You can.. as an HTA application.
HTA gets a lot of bad press because it's an obvious tool for virus
writers, but it effectively allows you to write an HTML application
that lives outside the Browser sandbox. If you're not looking to put
it online, and need a rapid dev environment, it's ideal. I've used it
to produce simple applications before that leverage the easy displaying
power of HTML, to be run from a local pc or over a network. Obviously
all your code is visible, so not recommended for anything that requires
security.

Also, because it's out of the sandbox, you can do all manner of loading
and saving files using the standard FileSystemObjec t (or any other Com
type stuff).

Jul 23 '05 #7
Where can i get information on HTA.

Jul 23 '05 #8
Kind of hard to find definitive guides to all it's uses, but
http://msdn.microsoft.com/workshop/a...taoverview.asp
gives you an overview. Basically it's an HTML file, saved as .HTA, run
using MSHTA.exe (in windows path).
Think it only really needs some sort of rudimentary tag in the head
like
<HTA:APPLICATIO N ID="oHTA"
APPLICATIONNAME ="MyApp"

From there just build HTML as usual. I keep my scripts in a seperate

..js file, linked in.

It's sometimes hard to find Javascript syntax for things like
FileSystemObjec t, but the info is out there on the web. Takes some time
to find, and if you are familiar with the VB versions, it doesn't
require much altering.

You could of course write the HTA using VBScript...

Jul 23 '05 #9
I have coded the open dialog in vbscript but couldn't find the save as, as
vbscript is the preferred method for the client.

Jul 23 '05 #10

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

Similar topics

7
16227
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the FileOpen and FileSave Common Dialog Boxes the best way to go in general? 3. For Most of my projects I will be using the same types of data input form and report output form, as discussed here recently. Also, the files that are
3
10803
by: bbxrider | last post by:
running win2k adv server/ iis5.0 trying to setup on my web page where browsers can download a file, an .xls so been trying to figure out with a download 'link' what invokes the standard ms file save dialog, hopefully without using vbscript other web pages i have seen have a simple link such as : <a href="someDir/someFile.xls">Download</a> when i used that, it just opens the spreadsheet and actually allows me to use the spreadsheet...
5
11062
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been created in the wrong folder on the hard drive. Before I discovered these files, .NET kept trying to create a new project with _1 following the project name. Deleting those files corrected that problem. I deleted the Virtual Directory, rebooted, and...
2
2395
by: yanivoliver | last post by:
Hey, I'm currently trying to find a way to open a dialog box that will allow me to select more than one file at a time, so if I want to upload select all the files in a directory, I won't have to have the number of dialog boxes as files in the directory. I was thinking of using a ActiveX control, but I don't want to make the sure download additional components to be able to do this, so is there maybe some sort of Windows ActiveX control...
0
1371
by: thomasp | last post by:
Wrong title should be File Save Dialog. I have a VB2005 program that has to import data from a 3.5 floppy drive and USB drives. I use a file open dialog to choose the file, works great. The problem occurs the next time I wish to open a file. If the last import was done from a floppy drive the program looks for a floppy drive first and if it has been removed I get an error. While I could just catch the error, I would rather know how...
5
12318
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. On Beta1, I am able to execute a particular page with no problem, that page opens up in the comes up just fine. On Win2kdev1, when I go to execute the same page, it opens a file download dialog and asks me whether I want to open or save the...
3
11080
by: Highlander | last post by:
Hello all. Consider the following HTA: <HTML> <HEAD> <TITLE></TITLE></HEAD> <BODY> <SCRIPT LANGUAGE="VBScript"> Sub ButBrowse_onclick() '-- show browse window and Get file path:
11
2204
by: GaryDean | last post by:
We created a "File" website on XP and transferred it over to server2003. Now we want to change it to an HTTP site. Without creating a new project and importing everthing, it there a way to convert it? the properties show file:///C:/Inetpub/wwwroot /etc. but it can't be changed to HTTP. It's got to be somewhere in some configuration file. -- Regards, Gary Blakely
3
5860
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 of the data from the flexgrid goes into the CSV file and so I have a couple of questions. 1, How do I make the application load the data from a specific CSV file? 2, How do I make it so that the user is able to add information to the data and...
1
47501
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 on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9793
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
10489
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7746
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4411
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
3959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
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.