473,511 Members | 14,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

downloading files from filesystem

My app needs to provide download of files (in this case .doc files) that
exist on the file system. I have the physical filestring i.e.
c:\myfilesdir\smith resume.doc.
but if I load that into a navigateurl it doesn't work. Nor does
file://c:\myfilesdir\smith resume.doc. Or any thing else I try.

How can I do this?

Thanks,
T
Aug 14 '07 #1
3 1292
On Aug 14, 7:15 am, "Tina" <TinaMSeab...@nospamexcite.comwrote:
My app needs to provide download of files (in this case .doc files) that
exist on the file system. I have the physical filestring i.e.
c:\myfilesdir\smith resume.doc.
but if I load that into a navigateurl it doesn't work. Nor does
file://c:\myfilesdir\smith resume.doc. Or any thing else I try.

How can I do this?

Thanks,
T
hi,
try this way
String file = Server.MapPath("~/labla/") +
"labla....";
string fileName = "ClientFileName";

try
{
FileStream downloadFile = new FileStream(file,
FileMode.Open);

Response.Clear();

Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition",
"attachment; filename=\"" + fileName + "\"");
Response.AddHeader("Content-Length",
downloadFile.Length.ToString());

downloadFile.Close();

Response.WriteFile(file);

Response.Flush();
}
catch (Exception ex)
{
//...............

}

hope help
nahid
http://nahidulkibria.blogspot.com

Aug 14 '07 #2
You should be able to distribute your files as desired using the techniques
I've detailed here:
http://dotnetslackers.com/articles/a...ileDenial.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Tina" <Ti**********@nospamexcite.comwrote in message
news:ux**************@TK2MSFTNGP03.phx.gbl...
My app needs to provide download of files (in this case .doc files) that
exist on the file system. I have the physical filestring i.e.
c:\myfilesdir\smith resume.doc.
but if I load that into a navigateurl it doesn't work. Nor does
file://c:\myfilesdir\smith resume.doc. Or any thing else I try.

How can I do this?

Thanks,
T
Aug 14 '07 #3
You should be able to distribute your files as desired using the techniques
I've detailed here:
http://dotnetslackers.com/articles/a...ileDenial.aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
"Tina" <Ti**********@nospamexcite.comwrote in message
news:ux**************@TK2MSFTNGP03.phx.gbl...
My app needs to provide download of files (in this case .doc files) that
exist on the file system. I have the physical filestring i.e.
c:\myfilesdir\smith resume.doc.
but if I load that into a navigateurl it doesn't work. Nor does
file://c:\myfilesdir\smith resume.doc. Or any thing else I try.

How can I do this?

Thanks,
T
Aug 17 '07 #4

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

Similar topics

2
2416
by: Bala | last post by:
Hi I am trying to download the PDF files from my webserver using ASP.Net. All my files are stored at F Drive on webserver. Like this F:\Main Folder\Sub Folder\Files\File1.pdf I am...
2
2053
by: Joolz | last post by:
Hello everyone, Sorry if this is a FAQ, but I've groups.googled the subject and can't find a definite answer (if such a thing exists). I'm working on a db in postgresql on a debian stable...
0
903
by: Rob | last post by:
The value of argument 'searchType' (0) is invalid for Enum type 'SearchOption'. Parameter name: searchType A little lost here, Latest VBExpress beta, new to VB. I am trying to list files in a...
1
2049
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
0
1621
by: just.starting | last post by:
I am having problem while downloading files from an apache server2.0.53 with php4.3.10.While downloading some files it generally stops after downloading some specific amount and then stops...
6
2198
by: Martin A. Weinberger | last post by:
Hi All, Using JavaScript, how do I download a file to a user's computer that I have stored on the server in a relatively browser indepdent way? That is will work on Mozilla and Macintosh Safari...
2
8117
by: Edhy Rijo [Progytech] | last post by:
Hi All, I am learning VB.NET and building small application that will do the following: 1.. Copy all files from a DVD to a specific folder in the hard drive and overwrite all files always. The...
3
1892
by: Lucky_Syringe | last post by:
I wrote this script to display different files from a database and properly display them by their respective MIME types. I have two questions: the first is that it just so happens not to work, and...
5
4457
by: mohi | last post by:
hello everyone i m positing this again but can't help as im not finding any solution to this . my problem is i have to browse a directory to search for all the files in it and process certain...
0
7137
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
7349
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,...
0
7417
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
5659
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,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
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...
0
3219
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...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
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 ...

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.