473,545 Members | 4,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save File Dialog

Hello Group

How do I open a Save File Dialog from an ASPX page behind a browse button?

Any help would be fantastic!!

I am using ASP.NET 1.1 using VB.NET as the coding language

TIA
Mar 13 '06 #1
4 6246
Here is some sample code that will download a text file named download.txt
with some text and the date/time appended to the end. To download another
file type you would do the same thing, just change the Response.Conten tType
and Response.WriteF ile lines, and possibly add or remove any Response.Write
or Response.WriteF ile lines. One thing that you can also do is not save the
file at all, and just use a bunch of Response.Write lines to dynamically
create something like a tab delimited data file or a schedule or reciept or
whatever, using only Response.Write saves you the trouble of saving a
temporary file every time someone downloads something unique to their
situation. I think you probably have the basic idea, if you have any
problems, let me know.
Private Sub btnDownload_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDownload.Cli ck
Response.ClearC ontent()
Response.Conten tType = "text/plain"
Response.AddHea der("content-disposition",
"attachment;fil ename=download. txt")
Response.WriteF ile(Server.MapP ath("download.t xt"))
Response.Write( "This is a test download text file" & ControlChars.Ne wLine)
Response.Write( Date.Now.ToLong DateString() & " " &
Date.Now.ToLong TimeString())
Response.End()
End Sub
Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Jonny" <jo***@beagood. sod> wrote in message
news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
Hello Group

How do I open a Save File Dialog from an ASPX page behind a browse button?

Any help would be fantastic!!

I am using ASP.NET 1.1 using VB.NET as the coding language

TIA

Mar 14 '06 #2
Thank you for your suggestion, but I would like the user to be able to pick
either a BMP or JPG file via an Open File Dialog or Save File Dialog & that
file then becomes the attachment of the e-mail

There is a KB article
(http://support.microsoft.com/?scid=k...245&sid=global
) which opens a file of the user's choice, but it then sends that file to
the server rather than being able to attach it to an e-mail. I need to be
able to attach it as an e-mail attachment, not upload it

I hope you understand
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:uY******** ******@tk2msftn gp13.phx.gbl...
Here is some sample code that will download a text file named download.txt
with some text and the date/time appended to the end. To download another
file type you would do the same thing, just change the Response.Conten tType and Response.WriteF ile lines, and possibly add or remove any Response.Write or Response.WriteF ile lines. One thing that you can also do is not save the file at all, and just use a bunch of Response.Write lines to dynamically
create something like a tab delimited data file or a schedule or reciept or whatever, using only Response.Write saves you the trouble of saving a
temporary file every time someone downloads something unique to their
situation. I think you probably have the basic idea, if you have any
problems, let me know.
Private Sub btnDownload_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDownload.Cli ck
Response.ClearC ontent()
Response.Conten tType = "text/plain"
Response.AddHea der("content-disposition",
"attachment;fil ename=download. txt")
Response.WriteF ile(Server.MapP ath("download.t xt"))
Response.Write( "This is a test download text file" & ControlChars.Ne wLine) Response.Write( Date.Now.ToLong DateString() & " " &
Date.Now.ToLong TimeString())
Response.End()
End Sub
Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Jonny" <jo***@beagood. sod> wrote in message
news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
Hello Group

How do I open a Save File Dialog from an ASPX page behind a browse button?
Any help would be fantastic!!

I am using ASP.NET 1.1 using VB.NET as the coding language

TIA


Mar 14 '06 #3
I am a little confused about what you are looking to do. The code I sent you
lets the user download the file from the server to their computer. If you
are looking to upload a file from the client to the server, use a
System.Web.UI.H tmlControls.Htm lInputFile control (I can show you the code to
upload a file using this control if you want). If you want to give the user
the choice between a .bmp and a .jpeg, simply create either two buttons that
they can click or use some extra control(s) such as a DropDownList or
RadioButton so that they can specify which one they want. If you are trying
to let the user attach a file to an email that will be sent from the server,
use the System.Web.Mail .MailMessage class. If you would like any help doing
any of these things, or if you are trying to do something that I am missing,
provide any details you can so that me or anyone else who reads your message
can do their best to help. Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Jonny" <jo***@beagood. sod> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Thank you for your suggestion, but I would like the user to be able to
pick
either a BMP or JPG file via an Open File Dialog or Save File Dialog &
that
file then becomes the attachment of the e-mail

There is a KB article
(http://support.microsoft.com/?scid=k...245&sid=global
) which opens a file of the user's choice, but it then sends that file to
the server rather than being able to attach it to an e-mail. I need to be
able to attach it as an e-mail attachment, not upload it

I hope you understand
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:uY******** ******@tk2msftn gp13.phx.gbl...
Here is some sample code that will download a text file named
download.txt
with some text and the date/time appended to the end. To download another
file type you would do the same thing, just change the

Response.Conten tType
and Response.WriteF ile lines, and possibly add or remove any

Response.Write
or Response.WriteF ile lines. One thing that you can also do is not save

the
file at all, and just use a bunch of Response.Write lines to dynamically
create something like a tab delimited data file or a schedule or reciept

or
whatever, using only Response.Write saves you the trouble of saving a
temporary file every time someone downloads something unique to their
situation. I think you probably have the basic idea, if you have any
problems, let me know.
Private Sub btnDownload_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDownload.Cli ck
Response.ClearC ontent()
Response.Conten tType = "text/plain"
Response.AddHea der("content-disposition",
"attachment;fil ename=download. txt")
Response.WriteF ile(Server.MapP ath("download.t xt"))
Response.Write( "This is a test download text file" &

ControlChars.Ne wLine)
Response.Write( Date.Now.ToLong DateString() & " " &
Date.Now.ToLong TimeString())
Response.End()
End Sub
Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Jonny" <jo***@beagood. sod> wrote in message
news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
> Hello Group
>
> How do I open a Save File Dialog from an ASPX page behind a browse button? >
> Any help would be fantastic!!
>
> I am using ASP.NET 1.1 using VB.NET as the coding language
>
> TIA
>
>



Mar 14 '06 #4
Hello Nathan

Thank you once again for your reply.

I do not wish for the user to send a file to the server, but to be able to
use an Open or Save File Dialog to choose a file (JPG or BMP) to e-mail a
certain address

There is a form which the use fills in to report any computer or printer
problems. Maybe the user has done a screen dump of an error message too. I
want for that file to be chosen by the user which then gets added to a
certian address:

Example (typed straight in here):

Dim mes As New System.Web.Mail .Message
Dim mesAttachment As ...MessageAttac hment
With mes
.From = so**@address.co m
.To = co************@ domain.com
.Subject = cboFault.Text

Pseudo

If Not mesAttachment <> Nothing Then
mesAttachment = New MessageAttachme nt (mesAttachment[Filename
Here].[Extension Here])
End If
End With

SmtpMail.Send(m es)

-----------------------------------------

The way you describe regarding the radio buttons isn't a good idea because
the users (school teachers) won't bother setting them & then they will just
call the office when I need it logged like above. Therefore I need that
OpenFileDialog for the teachers to use & to be able to select an screen dump
if they have one...

If I upload the file to the server then there could be a particular user
calling a simular screen dump the same name as one listed on the server then
it will be overwritten.

In the document (see KB link) they do what you have shown me, but I need
that chosen file e-mailed & not uploaded to the server. If the users
(teachers) haven't chosen a file (screen dump) then to send the e-mail
anyway without the requirement of an attachment.

I hope this have cleared up what I need. If not, I will knock up a Windows
application that does exactly what I want & paste the whole form class code
here for you to replicate. Then you will see what I need in a web based
page.

Thank you once again for your reply

Regards,

Jonny

"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:un******** ********@TK2MSF TNGP10.phx.gbl. ..
I am a little confused about what you are looking to do. The code I sent you lets the user download the file from the server to their computer. If you
are looking to upload a file from the client to the server, use a
System.Web.UI.H tmlControls.Htm lInputFile control (I can show you the code to upload a file using this control if you want). If you want to give the user the choice between a .bmp and a .jpeg, simply create either two buttons that they can click or use some extra control(s) such as a DropDownList or
RadioButton so that they can specify which one they want. If you are trying to let the user attach a file to an email that will be sent from the server, use the System.Web.Mail .MailMessage class. If you would like any help doing any of these things, or if you are trying to do something that I am missing, provide any details you can so that me or anyone else who reads your message can do their best to help. Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Jonny" <jo***@beagood. sod> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Thank you for your suggestion, but I would like the user to be able to
pick
either a BMP or JPG file via an Open File Dialog or Save File Dialog &
that
file then becomes the attachment of the e-mail

There is a KB article
(http://support.microsoft.com/?scid=k...245&sid=global
) which opens a file of the user's choice, but it then sends that file to the server rather than being able to attach it to an e-mail. I need to be able to attach it as an e-mail attachment, not upload it

I hope you understand
"Nathan Sokalski" <nj********@hot mail.com> wrote in message
news:uY******** ******@tk2msftn gp13.phx.gbl...
Here is some sample code that will download a text file named
download.txt
with some text and the date/time appended to the end. To download another file type you would do the same thing, just change the

Response.Conten tType
and Response.WriteF ile lines, and possibly add or remove any

Response.Write
or Response.WriteF ile lines. One thing that you can also do is not save

the
file at all, and just use a bunch of Response.Write lines to dynamically create something like a tab delimited data file or a schedule or
reciept or
whatever, using only Response.Write saves you the trouble of saving a
temporary file every time someone downloads something unique to their
situation. I think you probably have the basic idea, if you have any
problems, let me know.
Private Sub btnDownload_Cli ck(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnDownload.Cli ck
Response.ClearC ontent()
Response.Conten tType = "text/plain"
Response.AddHea der("content-disposition",
"attachment;fil ename=download. txt")
Response.WriteF ile(Server.MapP ath("download.t xt"))
Response.Write( "This is a test download text file" &

ControlChars.Ne wLine)
Response.Write( Date.Now.ToLong DateString() & " " &
Date.Now.ToLong TimeString())
Response.End()
End Sub
Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Jonny" <jo***@beagood. sod> wrote in message
news:Oe******** ******@TK2MSFTN GP11.phx.gbl...
> Hello Group
>
> How do I open a Save File Dialog from an ASPX page behind a browse

button?
>
> Any help would be fantastic!!
>
> I am using ASP.NET 1.1 using VB.NET as the coding language
>
> TIA
>
>



Mar 15 '06 #5

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

Similar topics

3
4159
by: cathywigzell | last post by:
I have a web page which allows a user to download a file directly to their computer, using IE. I present a file name in a table and the user can then right click on the file name to get a popup menu with the option 'Save Target As...'. Selecting that option results in the Save As dialog. However, if the filename has a reconginsed extension,...
2
2358
by: Alvo von Cossel I | last post by:
hi, i have a textbox in a form. when you press a Save button, a savefiledialog appears. creating ther file works but everytime you click save, the dialog appears. how do i make the dialog appear once and then only save the file? thanx -- Alvo von Cossel I of Germany
4
5080
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv" When the user clicks the HyperLink I would always like to
4
5526
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. When the user clicks to start the download I would like to display the "Save As" dialog, allow the user to name a place to save the file, and then...
0
2961
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save...
4
3666
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" & FileName) .Charset = ""
1
1438
by: M Pearson | last post by:
Hello there all, am very new to asp.net programming and am struggling with this problem. What I trying to achieve. On a button click I want the standard web save as dialog to display. The user specifies where to save. I then generate the file which is a series of reports zipped up, which then gets saved to the users pc. The following is...
3
6422
by: =?Utf-8?B?YXNkZg==?= | last post by:
Hello. I am making a web application with c# and am using this code: Response.ContentType = "application/x-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("あいうえお") + ".csv"); Encoding encoding = Encoding.GetEncoding("Shift-JIS"); Response.BinaryWrite(encoding.GetBytes(csvStr));...
2
10973
by: vbaDev | last post by:
Hi. I am using Access 2000 and in my code I'm exporting a table into an Excel file (creating it), then the code needs to export another query into the same file (a new worksheet). So I needed both a "Save As" dialog and the ability to grab the filepath so that the second export appends to it. Anyway, I found Microsofts method and it works,...
0
7464
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, well explore What is ONU, What Is Router, ONU & Routers main...
0
7396
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...
0
7656
Oralloy
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. ...
0
7805
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...
0
7751
tracyyun
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...
0
3449
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...
0
3440
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1874
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
0
700
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...

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.