Hi,
My issue is twofold.
1) How do I invoke a "save file" action when a user clicks a button.
In classic ASP, I used to response.redire ct to file path. But I want
to keep the user on the same page they clicked "Download" button.
2) How do I force to prompt for a save file when the user clicks the button
rather than try to open and read the file in the browser, which is the
default action.
Thanks,
Do 1 1210
This may do what you want (here file names for download are listed in a
radio button list)
Dim filepath As String
Dim filename As String
If Me.RadioButtonL ist1.SelectedIn dex <> -1 Then
filename =
Me.RadioButtonL ist1.Items(Me.R adioButtonList1 .SelectedIndex) .Text
filepath = Server.MapPath( ".") & "\downloads \" & filename
Else
Exit Sub
End If
Response.Clear( )
Response.Conten tType = "applicatio n/octet-stream"
Response.AddHea der("Content-Disposition", _
"attachment ; filename=""" & filename & """")
Response.WriteF ile(filepath)
"Do" <do************ *@hotmail.com> wrote in message
news:eC******** *****@tk2msftng p13.phx.gbl... Hi,
My issue is twofold.
1) How do I invoke a "save file" action when a user clicks a button. In classic ASP, I used to response.redire ct to file path. But I want to keep the user on the same page they clicked "Download" button.
2) How do I force to prompt for a save file when the user clicks the
button rather than try to open and read the file in the browser, which is the default action.
Thanks,
Do
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: D. Alvarado |
last post by:
Hello,
I have a page that generates a text file (but writes the file with
the ".csv" extension) and then I redirect the user so he can save the
file
header("Location: $my_csv_file");
However, the file appears as text in the browser and I would prefer
that the gray "Download this file" box pop up. How could I pull this
off, or is this really more dependent on client browser settings?
|
by: Julie |
last post by:
I have an html file where I display name,address,zip. It is one per line so
it is basicall a list of addresses.
But I would like ie6 to force the download prompt of this long list of names
instead of displaying it to their browsers. This way they can save the list
to a file. I know I can set it up as a txt file and let them download it
that way, but right now this file is generated from a source program which I
have no control over...
|
by: jmd |
last post by:
Hello.
I want to write a C# program that does completely automatically what, until
now, I do manually, witch is describe below :
1. I launch IE (6)
2. I browse to my desired download page, say
http://www.site.com/download
This download page contains some textboxes, checkboxes,
radiobuttons, a DOWNLOAD BUTTON and text
3. I check some checkboxes, select some radiobuttons, enter text in some
textboxes and click on the download button
|
by: Roy |
last post by:
Hi,
I have a problem that I have been working with for a while.
I need to be able from server side (asp.net) to detect that the file i'm
streaming down to the client is saved completely/succsessfully on the
client's computer before updating some metadata on the server (file
downloaded date for instance)
However,
All examples i have tried, and all examples I have found that other people
says works - doesn't work for me :-(
|
by: jmd |
last post by:
Hello, I posted the following in the C# forum but without one answer.
But perhaps now in vb.net someone has some guidelines !
This is my question :
I want to write a vb.net program that does completely automatically what,
until
now, I do manually, witch is describe below :
1. I launch IE (6)
| |
by: Brett Kelly |
last post by:
Ok, I know this sounds odd. Let me explain further.
I have an ASP.net page (w/ C# code behind) that, when given a session
variable containing the path to a local file, will attempt to start the
download of that file for the user.
Here's the content of my Page_Load:
protected void Page_Load(object sender, EventArgs e)
{
|
by: teeBull |
last post by:
Hi all,
We'd like to take advantage of code we already have for transforming
XML into HTML (using XSLT) for our users to save the HTML as an MS Word
document locally. I've dug around and found the following code to
include in the code behind:
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader("Content-Disposition",
"inline;filename=someFile.doc")
|
by: pd |
last post by:
guys,
in my web app, i have a simple download button and a href which points
to a file on my server, when the user clicks on the button or the
link, the file should simply be downloaded to the users machine. now
this file is a postgres backup file with the .backup extension.
now when i use the button, in FF the file download button pops up and
i can save the file, i can also right click the href and go save link
as. and it works fine.
|
by: Irfan12 |
last post by:
i dont know php & i want a script that when a user click on a mp3 hyperlink, the mp3 file start downloading instead of start playing in media player.
i got a sxript from internet search.
i am using the following code
<?php
$filename = "path/to/file/filname.ext";
if(!file_exists($filename)) {
die("File does not exist!");
}
header("Pragma: public");
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: 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.
| |