Is there a way of making a file download directly??? (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


Xenon -> Is there a way of making a file download directly??? (12/30/2004 13:37:14)

I have a .doc file that I want users to download. So when they click on the link that takes them to the .doc file, the Word file opens up in the explorer. Is there a way of making it download directly as if it was any other file where you click [open] [download] [cancel]?????




dpf -> RE: Is there a way of making a file download directly??? (12/30/2004 13:39:51)

quote:

the Word file opens up in the explorer
Ive never experienced a word file opening directly in explorer..interesting




Spooky -> RE: Is there a way of making a file download directly??? (12/30/2004 14:20:19)

Its best to save it as a zip file (easiest and pretty universal), or use some form of stream like so :

Response.ContentType = "application/asp-unknown"
Response.AddHeader "content-disposition","attachment; filename=" & fileName
Set FStream = Server.CreateObject("ADODB.Stream")
FStream.Open()
FStream.Type = 1
FStream.LoadFromFile(filePath&filename)
Response.BinaryWrite FStream.Read()
FStream.Close
Set FStream = Nothing


File path and file name need to be valid.
Such as "C:\inetpub\wwwroot\file.doc"




Xenon -> RE: Is there a way of making a file download directly??? (12/30/2004 16:02:33)

Thanks this is work just fine




Andraw -> RE: Is there a way of making a file download directly??? (1/16/2005 21:09:03)

Xenon,
when you use the code above to let user download your .doc file, the pictures/header/footer is still there when user open the downloaded file?

Are you familiar the way to creater word file dynamically by using createObject("Word.Application")? I need more reference about it.

Did you create your .doc file dynamically? did you zip it? how?

Thanks!

Andraw




Larry M. -> RE: Is there a way of making a file download directly??? (1/16/2005 21:47:11)

quote:

Is there a way of making it download directly as if it was any other file where you click [open] [download] [cancel]?????


Xenon,

Yes, just hyperlink to the file and publish. You can see an example of a file in both zipped PDF format and native Word (right hand side of page) here:

http://www.easleychamber.org/chamber_history.htm

The Word document will open for viewing in Explorer & FireFox and, optionally, can be printed like any other document. It can also be downloaded. As Spooky mentioned, Word files can be zipped and made available for download as well but, of course, they can't be opened directly in this format.





Andraw -> RE: Is there a way of making a file download directly??? (1/16/2005 22:34:05)

Larry,

Thanks for your response.
I go to the link and see the source code, it seems that it create the contents in the left side by using html, and create a word file and pdf zip file with the same content, my understand is right? can I dynamically create the left side content by using html, then dynamically save the left side content as word file to let user download?

Andraw




Larry M. -> RE: Is there a way of making a file download directly??? (1/17/2005 13:13:47)

quote:

I go to the link and see the source code, it seems that it create the contents in the left side by using html, and create a word file and pdf zip file with the same content, my understand is right?


Andraw,

Yes, the content is from a single source but offered in two formats to the visitor - Word & zipped PDF,

quote:

can I dynamically create the left side content by using html, then dynamically save the left side content as word file to let user download?


If by this you mean can you create a Word document form HTML?, then the answer is yes. After that, save the Word document and publish as a hyperlinked file. (I create a separate subdirectory under the root of the web named _files to help with site management) It will then open in the visitor's browser with options to print or download.

Not sure what you mean by "dynamically" as it pertains to this particular function.




pallavi_lodaya -> RE: Is there a way of making a file download directly??? (2/2/2005 2:50:52)

Spooky,

You have mentioned for downloading a file. If I woant to print my word doc, can I open in HTML format as you have mentioned and print it?




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125