473,385 Members | 1,748 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,385 software developers and data experts.

downloading more than 1 file in a single page

hi Frinny hope u'll notice my new doubt.
how is this downloading option given in asp.net? im using asp.net 1.1 n c# as programming lang and sql server as back end.
i actually tried it worked fine but only for a single file, in case if i give more than i file for download in the same page it gives the first file only for download it isnt considering the second one ....
Expand|Select|Wrap|Line Numbers
  1. private void Page_Load(object sender, System.EventArgs e)
  2. {
  3. Response.Clear();
  4. string path = Request.QueryString["fname"];
  5. System.IO.FileInfo a = new System.IO.FileInfo("c:/IP_Handbook.pdf");
  6. Response.AddHeader("Content-Disposition","attachment;filename =" +a.Name);
  7. Response.AddHeader("Content-Length",a.Length.ToString());
  8. Response.ContentType="application/octate-stream";
  9. Response.WriteFile(a.FullName);
  10. Response.End();
  11. }
in the design page i have used 2 hyperlinks and in the url path i hv given the path of the pdf file (which i hv chosen here) - all these design is in webform1 and the code is in another webform2 - where there is nothing in design sheet.

i want to use this technique for archieving monthly newsletter...please help me.
May 2 '08 #1
6 1275
Frinavale
9,735 Expert Mod 8TB
hi Frinny hope u'll notice my new doubt.
how is this downloading option given in asp.net? im using asp.net 1.1 n c# as programming lang and sql server as back end.
i actually tried it worked fine but only for a single file, in case if i give more than i file for download in the same page it gives the first file only for download it isnt considering the second one ....
Expand|Select|Wrap|Line Numbers
  1. private void Page_Load(object sender, System.EventArgs e)
  2. {
  3. Response.Clear();
  4. string path = Request.QueryString["fname"];
  5. System.IO.FileInfo a = new System.IO.FileInfo("c:/IP_Handbook.pdf");
  6. Response.AddHeader("Content-Disposition","attachment;filename =" +a.Name);
  7. Response.AddHeader("Content-Length",a.Length.ToString());
  8. Response.ContentType="application/octate-stream";
  9. Response.WriteFile(a.FullName);
  10. Response.End();
  11. }
in the design page i have used 2 hyperlinks and in the url path i hv given the path of the pdf file (which i hv chosen here) - all these design is in webform1 and the code is in another webform2 - where there is nothing in design sheet.

i want to use this technique for archieving monthly newsletter...please help me.
I've just done something similar with a reporting service I created.
What I ended up doing was saving the the files to a temporary location on the web server, then once these were created I displayed a <div> in the middle of the screen listing hyperlinks to the files that are ready for downloading.

I don't think that your method will allow you to let the user download more than one file at a time because it is writing the content directly to the Response.Write output stream stream instead of temporarily storing the data for download.

I tend to like doing exactly what you are doing because it reduces the need to clean up the resources.

If you're doing a newsletter...why not store a copy of the newsletter on the server and use a similar method to mine?

There's no need to dynamically create a newsletter because they are the same for all users.

-Frinny
May 2 '08 #2
hello frinny,
hmmmm ya ur right i wil try doing it, but my project manager wants himself to get the direct access to upload his newsletter to the intranet site instead of taking the assistance of a system admin...
he wants it to work something like this - whenever he wants to upload a newsletter ( usually in pdf format ) he will first login - this login right is given only for him and once he enters he must be able to add or delete files, thats it.
any normal user can download files but cannot upload....and all the older newsletters must join the archieve automatically as and when the recent newsletter is added.
thanks Frinny i will try it.
May 3 '08 #3
Frinavale
9,735 Expert Mod 8TB
hello frinny,
hmmmm ya ur right i wil try doing it, but my project manager wants himself to get the direct access to upload his newsletter to the intranet site instead of taking the assistance of a system admin...
he wants it to work something like this - whenever he wants to upload a newsletter ( usually in pdf format ) he will first login - this login right is given only for him and once he enters he must be able to add or delete files, thats it.
any normal user can download files but cannot upload....and all the older newsletters must join the archieve automatically as and when the recent newsletter is added.
thanks Frinny i will try it.
So you're not even storing your newsletters into a database :)
The files should already be on the server if your manager uploads them there.
Sounds like this could work :)

-Frinny
May 3 '08 #4
HI Frinny, hope ur doing good.
i actully din understand wt u meant...u mean the code im using right now shud work?
as i said it works but -
1. for upload it browses the file and uploads but works only with local drives and i donno wt to use or which asp.net ctrl to use in order to upload the selected file onto the webform...it needs database right...
2. for download only 1 hyperlink works fine where the designing part will be in webform1 and the coding part in webfrom2 which shud not have any design in it. In this case i will have to open n code in different webforms for each downloadable file na??
wt to do wt to do?
May 4 '08 #5
Frinavale
9,735 Expert Mod 8TB
HI Frinny, hope ur doing good.
i actully din understand wt u meant...u mean the code im using right now shud work?
as i said it works but -
1. for upload it browses the file and uploads but works only with local drives and i donno wt to use or which asp.net ctrl to use in order to upload the selected file onto the webform...it needs database right...
2. for download only 1 hyperlink works fine where the designing part will be in webform1 and the coding part in webfrom2 which shud not have any design in it. In this case i will have to open n code in different webforms for each downloadable file na??
wt to do wt to do?
No the code you have right now will only let you download one file at a time.
I was saying that this could work because I thought that your manager was uploading files to the web server already; in this case it would be easy to just reference them using hyperlinks.

To upload files to the server you use the FileUpload Control. You can upload the file and save it directly to a database, or simply save it to a folder on your web server that will let other people download it through a browser...

-Frinny
May 5 '08 #6
:) :) thanks a lot Frinny il check out with the company's system admin and c if they can help me do this way.....thanks so much again.
May 5 '08 #7

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

Similar topics

1
by: Marilyn Chalmers | last post by:
I am a newbie at HTML and web authoring and have a problem I cannot figure out. If I provide a link like this in my page and the user clicks on the link the document file is downloaded and...
5
by: John Morgan | last post by:
I am using the following link to download a file of about 50k <a target= "_blank" href="http://www.bsecs.org.uk/ExecDocs/documentStore/elfridaWord.doc">open file</a> If I save the file to...
1
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...
3
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...
5
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
9
by: AES | last post by:
I fairly often make PDF copies of web pages or sites by copying the web page link from the web page itself and pasting it into the Acrobat 7.0 Standard "Create PDF From Web Page" command. (Not...
1
by: Maury | last post by:
Hello, I would like to download multiple files with one click in a web form link, I know how to download a single file, and I think that a solution is to zip all the files in an archive, and then...
3
by: Chuck Renner | last post by:
Please help! This MIGHT even be a bug in PHP! I'll provide version numbers and site specific information (browser, OS, and kernel versions) if others cannot reproduce this problem. I'm...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.