Hi,
I would like to download all the files from a folder (of various types i.e.
..txt, .dll, .dat, etc.). I tried
Dim MyDir As IO.Directory
Dim path As String = Me.MapPath(".") & "\Data"
Dim dirs As String() = IO.Directory.Ge tFiles(path)
Dim iLoop As Integer
Dim FileName As String
'Set the appropriate ContentType.
Response.Conten tType = "multipart/mixed"
For iLoop = dirs.GetLowerBo und(0) To dirs.GetUpperBo und(0) - 1
FileName = dirs(iLoop).Sub string(dirs(iLo op).LastIndexOf ("\") + 1)
Response.Append Header("Content-Disposition", "attachment ; filename=" &
FileName)
Response.WriteF ile(dirs(iLoop) )
Next
This gets a single file with the name of the first file with all the files
combined. I have tried the multipart/mixed, but I not sure what to use as a
boundry or how to get the multiple filenames.
Any advice would be appreciated,
Thanks,
Stephen 3 2323
create a seperate page to which you can pass the file name to be downloaded
and use response.conten ttype and the rest of the code
what's happening right now is that its all coming as a part of one response
stream. you need to write the code to be intelligent enough to only
response.write one file and then release the stream
and start again with another call to the download page with another response
stream to serve
Regards,
HD
"Skwish" <st************ @comcast.net> wrote in message
news:3r******** ************@co mcast.com... Hi, I would like to download all the files from a folder (of various types
i.e. .txt, .dll, .dat, etc.). I tried
Dim MyDir As IO.Directory Dim path As String = Me.MapPath(".") & "\Data" Dim dirs As String() = IO.Directory.Ge tFiles(path) Dim iLoop As Integer Dim FileName As String 'Set the appropriate ContentType. Response.Conten tType = "multipart/mixed"
For iLoop = dirs.GetLowerBo und(0) To dirs.GetUpperBo und(0) - 1 FileName = dirs(iLoop).Sub string(dirs(iLo op).LastIndexOf ("\") + 1) Response.Append Header("Content-Disposition", "attachment ; filename="
& FileName) Response.WriteF ile(dirs(iLoop) ) Next
This gets a single file with the name of the first file with all the files combined. I have tried the multipart/mixed, but I not sure what to use as
a boundry or how to get the multiple filenames.
Any advice would be appreciated,
Thanks,
Stephen
O.K. Dave,
I tried this
Dim MyDir As IO.Directory
Dim path As String = Me.MapPath(".") & "\Data"
Dim dirs As String() = IO.Directory.Ge tFiles(path)
Dim iLoop As Integer
Dim FileName As String
For iLoop = dirs.GetLowerBo und(0) To dirs.GetUpperBo und(0) - 1
Response.Redire ct("Download.as px?filename=" & dirs(iLoop), false)
Next
I still get only one file (the first one if I use false to not terminate the
page and the second file if I use true to terminate). How do I stop the
stream after the first call and start again with the next one?
Thanks for the help,
Stephen
"Hermit Dave" <he***********@ CAPShotmail.com > wrote in message
news:el******** ******@TK2MSFTN GP09.phx.gbl... create a seperate page to which you can pass the file name to be
downloaded and use response.conten ttype and the rest of the code
what's happening right now is that its all coming as a part of one
response stream. you need to write the code to be intelligent enough to only response.write one file and then release the stream and start again with another call to the download page with another
response stream to serve
Regards,
HD
"Skwish" <st************ @comcast.net> wrote in message news:3r******** ************@co mcast.com... Hi, I would like to download all the files from a folder (of various types i.e. .txt, .dll, .dat, etc.). I tried
Dim MyDir As IO.Directory Dim path As String = Me.MapPath(".") & "\Data" Dim dirs As String() = IO.Directory.Ge tFiles(path) Dim iLoop As Integer Dim FileName As String 'Set the appropriate ContentType. Response.Conten tType = "multipart/mixed"
For iLoop = dirs.GetLowerBo und(0) To dirs.GetUpperBo und(0) - 1 FileName = dirs(iLoop).Sub string(dirs(iLo op).LastIndexOf ("\") + 1) Response.Append Header("Content-Disposition", "attachment ;
filename=" & FileName) Response.WriteF ile(dirs(iLoop) ) Next
This gets a single file with the name of the first file with all the
files combined. I have tried the multipart/mixed, but I not sure what to use
as a boundry or how to get the multiple filenames.
Any advice would be appreciated,
Thanks,
Stephen
Okay here what i think you should do to achieve this.
A Response cannot be initiated by itself
It only starts when there is a request from client.
So when the user clicks download.
1. Do a post to the server. Get the list of files
2. To self initiate a request from you can use register client block (put
the calls to the download file into client side javascript)
3. Create an array of files in javascript (client side)
4. use a for loop and within the for loop initiate a request to the server
using window.open("yo ur download file.asp?filena me=" +
filearray[currentpos])
5. This should initiate a request to the server to which your download page
can now respond to. you just have to request the request filename parameter
and check for its existance in your path... and start writing to response
stream.
This should should work.... something like going all the way but i am not
aware of any way you can initiate a response without client request.
HTH
HD
"Skwish" <st************ @meck.com> wrote in message >
O.K. Dave, I tried this
Dim MyDir As IO.Directory Dim path As String = Me.MapPath(".") & "\Data" Dim dirs As String() = IO.Directory.Ge tFiles(path) Dim iLoop As Integer Dim FileName As String
For iLoop = dirs.GetLowerBo und(0) To dirs.GetUpperBo und(0) - 1 Response.Redire ct("Download.as px?filename=" & dirs(iLoop), false) Next
I still get only one file (the first one if I use false to not terminate
the page and the second file if I use true to terminate). How do I stop the stream after the first call and start again with the next one?
Thanks for the help,
Stephen
"Hermit Dave" <he***********@ CAPShotmail.com > wrote in message
create a seperate page to which you can pass the file name to be downloaded and use response.conten ttype and the rest of the code
what's happening right now is that its all coming as a part of one response stream. you need to write the code to be intelligent enough to only response.write one file and then release the stream and start again with another call to the download page with another response stream to serve
Regards,
HD
"Skwish" <st************ @comcast.net> wrote in message Hi, I would like to download all the files from a folder (of various types i.e. .txt, .dll, .dat, etc.). I tried
Dim MyDir As IO.Directory Dim path As String = Me.MapPath(".") & "\Data" Dim dirs As String() = IO.Directory.Ge tFiles(path) Dim iLoop As Integer Dim FileName As String 'Set the appropriate ContentType. Response.Conten tType = "multipart/mixed"
For iLoop = dirs.GetLowerBo und(0) To dirs.GetUpperBo und(0) - 1 FileName = dirs(iLoop).Sub string(dirs(iLo op).LastIndexOf ("\") +
1) Response.Append Header("Content-Disposition", "attachment ; filename=" & FileName) Response.WriteF ile(dirs(iLoop) ) Next
This gets a single file with the name of the first file with all the files combined. I have tried the multipart/mixed, but I not sure what to
use as a boundry or how to get the multiple filenames.
Any advice would be appreciated,
Thanks,
Stephen
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Brandon Walters |
last post by:
I wrote a file download module for my website. The reason for the file
download module is that my website downloads work on a credit based system.
So I need to keep track of and limit daily downloads.
It uses fpassthru() and some headers() to send a file to the requesting
user. The get.php file that I wrote (the file download module if you will)
works like a charm for .ZIP files and .TXT files. However, when .EXE files
are downloaded...
|
by: Frank Jona |
last post by:
Intellisense with C# and a multi-file assembly is not
working. With VB.NET it is working.
Is there a fix availible?
We're using VisualStudio 2003
Regards
Frank
|
by: cody |
last post by:
What are multi file assemblies good for?
What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a
single multi file assembly (A.DLL+A.NETMODULE)?
|
by: Derrick |
last post by:
Anyone been able to get a multi file HTTP download working with ASP?
I have a single file download working fine with the usual setting the
content type, file name, stream the file from ADO.Stream, etc.
Thanks in advance!!
Derrick
|
by: Bob Rock |
last post by:
Hello,
I was wondering when multi-file assemblies may be useful.
With multi-file assemblies you may place inside the same assembly
netmodules coded in different languages and as a consequence code from
a module may obviously utilize private and internal classes defined in
other module (maybe even coded in different languages). Apart this I
personally see no other reasons to using multi-file assemblies.
| |
by: Buddy Ackerman |
last post by:
I am trying to implment a file download via a link such that when clicked,
instead of starting the default application for that type of file the user
will be presented with a download dialog window. Well, thanks to Steve Orr,
I have that working. However, I still have a few issues. First, the
download dialog does not have the name of the file being downloaded in the
"File name" field, instead it has the name of the aspx page that have...
|
by: Rhys666 |
last post by:
Basically I have a link that opens my download page and the querystring
identifies the type of 'template' Excel spreadsheet has asked to download.
The download page reads the querystring, identifies the template required
then uses Response.AppendHeader to amend the response to create the file
download dialogue. On my local machine this works fine and the download
dialogue correctly identifies the file name and type attempting to be...
|
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...
|
by: Curtis Rutland |
last post by:
Building A Silverlight (2.0) Multi-File Uploader
All source code is C#. VB.NET source is coming soon.
Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and Silverlight 2.0. To get these tools please visit this page
Get Started : The Official Microsoft Silverlight Site
and follow Step 1.
Occasionally you find the need to have users upload multiple files at once. You could use multiple FileUpload...
|
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...
|
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,...
| |
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,...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |