473,796 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File save dialog

I'm trying to make a page that, when opened, displays a file save dialog,
then closes itself (essentially just leaving the file save dialog). Is this
possible? I've tried this:

Response.Conten tType="image/JPEG";
//Response.AddHea der ("Content-Length", FileSize.ToStri ng());
Response.Append Header("Content-Disposition","a ttachment;
filename=img1.j pg");
Response.WriteF ile(@"c:\img1.j pg");
Response.Write( "<script>window .close();</script>");
Response.Flush( );

But the page does not close... any ideas?
Nov 18 '05 #1
2 2970
In your code there is a big error!

Response.Conten tType="image/JPEG";
Response.Append Header("Content-Disposition","a ttachment;
filename=img1.j pg");
Response.WriteF ile(@"c:\img1.j pg");
Response.Flush( );

with this code you send on client a jpg!
The result is the same as you write http://server/img1.jpg....

if you write a javascript in an imige it doesn't work!

Response.Write( "<script>window .close();</script>");
Is the same if you edit a Jpg with notepad and write inside this code!

If you want to close the page you can do :

1) make a first page with this tag element and script:

<iframe src="webform1.a spx"></iframe>
<script language=javasc ript>
<!--
window.close();
//-->
</script>
2) make a second page with your code!
the page that response image must have only code for image (no
HTML!). My council is to make a simple page, override the render method
without call the base and than place Response.Write inside this!

example :
protected override void Render(HtmlText Writer writer)
{
Response.Conten tType = "image/jpeg";
Response.AddHea der("Content-Disposition","a ttachment;filen ame=img1.jpg");
Response.WriteF ile(@"c:\Sample .jpg");
Response.Flush( );
}

Brun
"Ryan Moore" <ry*******@hotm ail.com> wrote in message
news:On******** ******@TK2MSFTN GP10.phx.gbl...
I'm trying to make a page that, when opened, displays a file save dialog,
then closes itself (essentially just leaving the file save dialog). Is this possible? I've tried this:

Response.Conten tType="image/JPEG";
//Response.AddHea der ("Content-Length", FileSize.ToStri ng());
Response.Append Header("Content-Disposition","a ttachment;
filename=img1.j pg");
Response.WriteF ile(@"c:\img1.j pg");
Response.Write( "<script>window .close();</script>");
Response.Flush( );

But the page does not close... any ideas?

Nov 18 '05 #2
In your code there is a big error!

Response.Conten tType="image/JPEG";
Response.Append Header("Content-Disposition","a ttachment;
filename=img1.j pg");
Response.WriteF ile(@"c:\img1.j pg");
Response.Flush( );

with this code you send on client a jpg!
The result is the same as you write http://server/img1.jpg....

if you write a javascript in an imige it doesn't work!

Response.Write( "<script>window .close();</script>");
Is the same if you edit a Jpg with notepad and write inside this code!

If you want to close the page you can do :

1) make a first page with this tag element and script:

<iframe src="webform1.a spx"></iframe>
<script language=javasc ript>
<!--
window.close();
//-->
</script>
2) make a second page with your code!
the page that response image must have only code for image (no
HTML!). My council is to make a simple page, override the render method
without call the base and than place Response.Write inside this!

example :
protected override void Render(HtmlText Writer writer)
{
Response.Conten tType = "image/jpeg";
Response.AddHea der("Content-Disposition","a ttachment;filen ame=img1.jpg");
Response.WriteF ile(@"c:\Sample .jpg");
Response.Flush( );
}

Brun
"Ryan Moore" <ry*******@hotm ail.com> wrote in message
news:On******** ******@TK2MSFTN GP10.phx.gbl...
I'm trying to make a page that, when opened, displays a file save dialog,
then closes itself (essentially just leaving the file save dialog). Is this possible? I've tried this:

Response.Conten tType="image/JPEG";
//Response.AddHea der ("Content-Length", FileSize.ToStri ng());
Response.Append Header("Content-Disposition","a ttachment;
filename=img1.j pg");
Response.WriteF ile(@"c:\img1.j pg");
Response.Write( "<script>window .close();</script>");
Response.Flush( );

But the page does not close... any ideas?

Nov 18 '05 #3

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

Similar topics

3
4183
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, e.g. .doc, then the Save As dialog adds another extension, so the file name in the Save As dialog...
2
2369
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
3694
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 = ""
3
2554
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in a certain directory and if it doesn't meet my criteria then I want to do a "save as" to a different location. How can I do that. I can't seem to get the save as dialog to grab the filename of the file in question and ask for a place to save it....
24
1958
by: Kelly | last post by:
Hey all - I need a little more help. I don't quite know why my text file or form isn't closing. Short version - this program takes data entered into a textbox, user clicks Save button, Save As dialog box pops open, user selects file to save to, data *should* save to the file, file close, form close. The way I have it written so far, the data *does* save to the file, however,
4
6266
by: Jonny | last post by:
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
17
8030
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: I am trying to use the SaveFileDialog class to get a filename, which is subsequently opened for writing (write access, read sharing, but using read/write sharing doesn't make the problem go away anyway). Sometimes, on the statement where I...
3
4035
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user selects? thanks...
1
1758
by: sunita | last post by:
Hiii I open a file download dialog from a modal dialog...From the file download dialog i can either save or open the file.. Is there a way i can let the modal dialog that opens the file download dialog know whether the user has clicked on the open button or the save button of the file download dialog??
3
5848
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...
0
9525
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
10452
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
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...
0
10003
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
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...
0
6785
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();...
1
4115
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
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
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.