473,721 Members | 4,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Invoking a directory browse for file(s) download

As a "newbie" to Javascript I need some help with my latest problem...

I have a number of image files that have been pre-selected by the user
for downloading. I'd like to be able to have the user click a button
and have a directory browser pop-up window available for the user to
select the directory into which the image files will be downloaded.

I thought that this would be simple to find but...

If this is possible I further need to know:

1) how to access the directory path string (which will be used to
download the files)

2) how to set any available default values for the directory bvrowser.

I'd really appreciate anyone being able to point me in a direction.

TIA
Glenn
Jul 23 '05 #1
6 18933
On 20 Sep 2004 08:28:07 -0700, in comp.lang.javas cript
go****@nixonpea body.com (Glenn Owens) wrote:
| As a "newbie" to Javascript I need some help with my latest problem...
|
| I have a number of image files that have been pre-selected by the user
| for downloading. I'd like to be able to have the user click a button
| and have a directory browser pop-up window available for the user to
| select the directory into which the image files will be downloaded.
|
| I thought that this would be simple to find but...
|
| If this is possible I further need to know:
|
| 1) how to access the directory path string (which will be used to
| download the files)
|
| 2) how to set any available default values for the directory bvrowser.
|
| I'd really appreciate anyone being able to point me in a direction.


If I understand you correctly then there is no need for this.
If the user right mouse clicks the image then they can select Save As
from the context menu. This in-turn will ask the user for the location
to save the file to.
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #2
Not true. As I mentioned I need a way to download a number of image
files from a gallery-style image search engine to a directory
destination of the user's choosing. Selecting each image with a
right-click and specifying the directory would be unnecessarily
tedious for the user.

I did find a way to involk the BrowseForFolder activeX control through
Javascript out on MSDN. So, I implemented, and tested, the control and
that seems to be working well. Here's the Javascript that I'm using:

function GetDownloadPath () {
var frm = document.forms[0];
var Shell = new ActiveXObject(" Shell.Applicati on");
var Folder = new Object;

Folder = Shell.BrowseFor Folder(0, "Choose a download folder", 0);

var FolderItem = new Object;
FolderItem = Folder.Items(). Item();

document.all.it em("lblFilepath ").InnerTex t = FolderItem.Path ;
frm.lblFilepath .Text = FolderItem.Path ;
}
Now, my out question is how to get the client-side FilePath back to
the server without a second round-trip to the server.

Any thoughts wsould be appreciated.

Glenn
Jul 23 '05 #3
On 21 Sep 2004 04:29:37 -0700, in comp.lang.javas cript
go****@nixonpea body.com (Glenn Owens) wrote:
| Not true. As I mentioned I need a way to download a number of image
| files from a gallery-style image search engine to a directory
| destination of the user's choosing. Selecting each image with a
| right-click and specifying the directory would be unnecessarily
| tedious for the user.
The user only has to navigate to their folder once and it becomes the
default folder so subsequent downloads go to that folder. The user can
also rename the file if required.
| I did find a way to involk the BrowseForFolder activeX control through
| Javascript out on MSDN. So, I implemented, and tested, the control and
| that seems to be working well. Here's the Javascript that I'm using:
|
| function GetDownloadPath () {
| var frm = document.forms[0];
| var Shell = new ActiveXObject(" Shell.Applicati on");
| var Folder = new Object;
|
| Folder = Shell.BrowseFor Folder(0, "Choose a download folder", 0);
|
| var FolderItem = new Object;
| FolderItem = Folder.Items(). Item();
|
| document.all.it em("lblFilepath ").InnerTex t = FolderItem.Path ;
| frm.lblFilepath .Text = FolderItem.Path ;
| }
I get 'Permission Denied' error message (WinXP SP2 IE6.0.29)

Error: ActiveXObject is not defined (NS7.1 and Mozilla1.7)
| Now, my out question is how to get the client-side FilePath back to
| the server without a second round-trip to the server.


You can't.
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #4
Lee
Glenn Owens said:

Not true. As I mentioned I need a way to download a number of image
files from a gallery-style image search engine to a directory
destination of the user's choosing. Selecting each image with a
right-click and specifying the directory would be unnecessarily
tedious for the user.

I did find a way to involk the BrowseForFolder activeX control through
Javascript out on MSDN. So, I implemented, and tested, the control and
that seems to be working well. Here's the Javascript that I'm using:

function GetDownloadPath () {
var frm = document.forms[0];
var Shell = new ActiveXObject(" Shell.Applicati on");
var Folder = new Object;

Folder = Shell.BrowseFor Folder(0, "Choose a download folder", 0);

var FolderItem = new Object;
FolderItem = Folder.Items(). Item();

document.all.it em("lblFilepath ").InnerTex t = FolderItem.Path ;
frm.lblFilepath .Text = FolderItem.Path ;
}
Now, my out question is how to get the client-side FilePath back to
the server without a second round-trip to the server.

Any thoughts wsould be appreciated.


Jeff is not just being difficult. What you're asking for would
be a serious security breach. If your code can decide where to
put things, what would prevent you from putting things in my
system directories? Only a few browsers with little respect for
the user's security allow any access to the user's filesystem at
all.

Jul 23 '05 #5
Mr. North,

As we are a Microsoft shop I'n less concerned over the fact that this
is the first time I'm used Microsoft-only controls (though I do try to
remain agnostic as to the platform. We are using WinXP SP1 IE6.0.28)
and the Shell.BrowseFro Folder is working well - no access errors. The
website is configured for Windows Authentication (only) and the
web.config file provides the ASPNET_WP with impersonation rights.

As far as getting the Filepath back from the client without a second
roundtrip (the first was to initiate the image download via an asp
button click)... this bacame easy to accomplish with a bit of
JavaScript and a "hidden" HTML input field in the form.

So, while - yes, I'm not addressing the NS and Mozilla users (of which
we have none) the remainder of the image search/engine/gallery
upload/download works just fine.

Glenn
Jeff North <jn****@yourpan tsbigpond.net.a u> wrote in message news:<1e******* *************** **********@4ax. com>...
On 21 Sep 2004 04:29:37 -0700, in comp.lang.javas cript
go****@nixonpea body.com (Glenn Owens) wrote:
| Not true. As I mentioned I need a way to download a number of image
| files from a gallery-style image search engine to a directory
| destination of the user's choosing. Selecting each image with a
| right-click and specifying the directory would be unnecessarily
| tedious for the user.


The user only has to navigate to their folder once and it becomes the
default folder so subsequent downloads go to that folder. The user can
also rename the file if required.
| I did find a way to involk the BrowseForFolder activeX control through
| Javascript out on MSDN. So, I implemented, and tested, the control and
| that seems to be working well. Here's the Javascript that I'm using:
|
| function GetDownloadPath () {
| var frm = document.forms[0];
| var Shell = new ActiveXObject(" Shell.Applicati on");
| var Folder = new Object;
|
| Folder = Shell.BrowseFor Folder(0, "Choose a download folder", 0);
|
| var FolderItem = new Object;
| FolderItem = Folder.Items(). Item();
|
| document.all.it em("lblFilepath ").InnerTex t = FolderItem.Path ;
| frm.lblFilepath .Text = FolderItem.Path ;
| }


I get 'Permission Denied' error message (WinXP SP2 IE6.0.29)

Error: ActiveXObject is not defined (NS7.1 and Mozilla1.7)
| Now, my out question is how to get the client-side FilePath back to
| the server without a second round-trip to the server.


You can't.
---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------

Jul 23 '05 #6
On 28 Sep 2004 13:59:55 -0700, in comp.lang.javas cript
go****@nixonpea body.com (Glenn Owens) wrote:
| Mr. North,
|
| As we are a Microsoft shop I'n less concerned over the fact that this
| is the first time I'm used Microsoft-only controls (though I do try to
| remain agnostic as to the platform. We are using WinXP SP1 IE6.0.28)
| and the Shell.BrowseFro Folder is working well - no access errors. The
| website is configured for Windows Authentication (only) and the
| web.config file provides the ASPNET_WP with impersonation rights.
Fine, considering none of this was mentioned in your original posting.
Where did you get this control from, why not contact them for support?
| As far as getting the Filepath back from the client without a second
| roundtrip (the first was to initiate the image download via an asp
| button click)... this bacame easy to accomplish with a bit of
| JavaScript and a "hidden" HTML input field in the form.
The fact still remains that you can't send information back to the
server without re-submitting the page.

You could use a frameset. The first frame being hidden (sized and
positioned out of the way on the page). The second page would
communicate with the first frame. The first frame would transmit this
information to the server.
| So, while - yes, I'm not addressing the NS and Mozilla users (of which
| we have none) the remainder of the image search/engine/gallery
| upload/download works just fine.
|
| Glenn
|
|
| Jeff North <jn****@yourpan tsbigpond.net.a u> wrote in message news:<1e******* *************** **********@4ax. com>...
| > On 21 Sep 2004 04:29:37 -0700, in comp.lang.javas cript
| > go****@nixonpea body.com (Glenn Owens) wrote:
| >
| > >| Not true. As I mentioned I need a way to download a number of image
| > >| files from a gallery-style image search engine to a directory
| > >| destination of the user's choosing. Selecting each image with a
| > >| right-click and specifying the directory would be unnecessarily
| > >| tedious for the user.
| >
| > The user only has to navigate to their folder once and it becomes the
| > default folder so subsequent downloads go to that folder. The user can
| > also rename the file if required.
| >
| > >| I did find a way to involk the BrowseForFolder activeX control through
| > >| Javascript out on MSDN. So, I implemented, and tested, the control and
| > >| that seems to be working well. Here's the Javascript that I'm using:
| > >|
| > >| function GetDownloadPath () {
| > >| var frm = document.forms[0];
| > >| var Shell = new ActiveXObject(" Shell.Applicati on");
| > >| var Folder = new Object;
| > >|
| > >| Folder = Shell.BrowseFor Folder(0, "Choose a download folder", 0);
| > >|
| > >| var FolderItem = new Object;
| > >| FolderItem = Folder.Items(). Item();
| > >|
| > >| document.all.it em("lblFilepath ").InnerTex t = FolderItem.Path ;
| > >| frm.lblFilepath .Text = FolderItem.Path ;
| > >| }
| >
| > I get 'Permission Denied' error message (WinXP SP2 IE6.0.29)
| >
| > Error: ActiveXObject is not defined (NS7.1 and Mozilla1.7)
| >
| > >| Now, my out question is how to get the client-side FilePath back to
| > >| the server without a second round-trip to the server.
| >
| > You can't.
| > ---------------------------------------------------------------
| > jn****@yourpant sbigpond.net.au : Remove your pants to reply
| > ---------------------------------------------------------------


---------------------------------------------------------------
jn****@yourpant sbigpond.net.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #7

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

Similar topics

6
11195
by: Jane Doe | last post by:
Hi, I need to add a download function in a VB program, but since a file can be located anywhere in our /download section on the web, I was thinking of putting a PHP script there that would take the filename as parameter, and browse through the /download directory to look for this file, including sub-directories, and return the URL, ie. IN http://www.acme.com/download/find.php?file=myfile.txt
1
3226
by: ASP Spam Fighter | last post by:
Hello all, I don't know how to get around this one... If anybody can help me with this problem, I would appreciate it very much. I've been trying to send a (large) file to the browser via a download page that uses a file download component. The file downloads fine, except that Internet Explorer refuses to browse to a different page while the file is downloading! I don't understand why it does that and I don't know how to fix this...
5
2821
by: kbrad | last post by:
I am trying to use SoftArtisans FileUp Professional to upload a directory. I have found some sample code to help but you have to type in the directory name when you run the page. I want to use a form in the same way as for a file upload to browse and select my directory for upload. Anyone know how to code this? Also are there any good places other than the official SA site to go for help with sample code?
3
10800
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...
4
12994
by: hamacher | last post by:
I have a particular need to an application . . . I need users to specify a directory (with path) on their filesystem on an HTML page. All I need at the server is a string representation of the path they choose. No file upload. No file names. Right now, I have users typing in full paths into an <input type="text"/> element. I would rather a HTML control to allow them browse to their selected directory. When they hit "OK", or...
0
2094
by: Jeff Reed | last post by:
I am experiencing the the problem outlined the below. Unfortunately, I am using WinXP and I not sure if I can apply the solution due to lack of security control Any feed back would be apreciated http://support.microsoft.com/default.aspx?scid=kb;EN-US;31795 FIX: "Failed to Start Monitoring Directory Changes" Error Message When You Browse to an ASP.NET Pag View products that this article applies to This article was previously...
2
2512
by: Danny Boy | last post by:
Hi, "Snif" is an excellent little script to index files and directories. It's just one single file, and the advantage is that you merely drop it into the directory you want to index, point a browser to the script and you're done. But to me, the simplicity is a DISadvantage since I need to index directories that are located down in the site hierarcy, and to which the users won't have direct access.
3
7115
by: SDRoy | last post by:
Hi Can someone please tell me how I can browse a FTP directory location in C# and then download. I am using something like: DirectoryInfo DirInfo = new DirectoryInfo("ftp://ftp.mysite.org/myftp/MYINBOUNDTEST"); FileInfo Files = DirInfo.GetFiles("*.asc");
1
2089
by: SGilch | last post by:
I am new to javascript, and wondering if it is capable of implementing a browsing mechanism for the browser to upload the names of files in a client side directory to the server. The client would select a local directory through its web browser based on a page from the server and when hitting the submit button would upload a list of the files in the directory. So, I am looking for a way where the client can: - click a browse button on the...
0
8852
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
8736
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
9227
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
9145
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,...
1
6676
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
5992
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
4497
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...
2
2590
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2143
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.