473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"save file" dialog box in clients

31
hi,

I am developing a system with asp.net, c#, and ajax.

I have an excel file in server in "Server.MapPath("ExcelFiles/Test.xls")".

I want to make it available to save to the disk in client side. I hope save file dialoge box will allow to do this. How can i do this?

thanks

Anushka
May 23 '08 #1
3 2531
Plater
7,872 Expert 4TB
Provide a link to the file? Or at least a page that will serve it up.
You will also need to remember add the content-disposition header to get the save file box to pop up in your clients browser.

Heres part of something I use
Expand|Select|Wrap|Line Numbers
  1. Response.Clear();
  2. Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
  3. Response.ContentType = ContentTypeString;
  4. Response.AddHeader("content-disposition", "attachment; filename=" + FileName);
  5. Response.WriteFile(FullPathFileName);
  6. Response.End();
  7.  
May 23 '08 #2
Curtis Rutland
3,256 Expert 2GB
Your best bet is to present the file for download. You could redirect to a page with a link to the download. But I am pretty sure that you can't use a Save File dialogue, because you can't create client side popups with server side code. But if you present it as a download, the client will get the browser's save file dialog.

hi,

I am developing a system with asp.net, c#, and ajax.

I have an excel file in server in "Server.MapPath("ExcelFiles/Test.xls")".

I want to make it available to save to the disk in client side. I hope save file dialoge box will allow to do this. How can i do this?

thanks

Anushka
May 23 '08 #3
Frinavale
9,735 Expert Mod 8TB
Your best bet is to present the file for download. You could redirect to a page with a link to the download. But I am pretty sure that you can't use a Save File dialogue, because you can't create client side popups with server side code. But if you present it as a download, the client will get the browser's save file dialog.
InsertAlias is correct, you cannot call the "SaveAs" dialog box in ASP.NET.
However you can just use an old-fashioned hyperlink that points to the file. Since Excel files can't be rendered in the browser, the browser itself will open a "SaveAs" dialog box to allow the user to download the file.

Make sure that the folder that contains the Excel file is on the web server or else this will not work.

-Frinny
May 23 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bill R via AccessMonster.com | last post by:
I have a procedure that runs when you dbl click in a txt box. It runs the docmd.acCmdHyperLink command. I am trying to find a way to have the "Insert Hyperlink" dialog box default to "Browse For"...
4
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. ...
3
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...
1
by: Tomas Martinez | last post by:
Hi, In my web I have a proccess of download reports which on first step generates a PDF, then flushes the buffer (the generated file) and finally deletes this file from server. Ok, the problem...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
7
by: Tim Slattery | last post by:
I'm trying to handle the onChange event in an <input type="file"> element. In IE, there's no problem: the event fires when a file in the "open" box is doubleclicked, or the "Open" button in the box...
1
by: deerchao | last post by:
I used these codes to provide a default "Save As" filename for browsers: Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName); Response.ContentType =...
1
by: sainathparuchuri | last post by:
As a project requirement we need to convert word documents to tiff images. We have been using Microsoft Office Document Image Writer (MODI) for this puspose and doing absolutely well. But now this...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
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,...

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.