aspose file tools*
The moose likes PHP and the fly likes Save as button on web page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » PHP
Bookmark "Save as button on web page" Watch "Save as button on web page" New topic
Author

Save as button on web page

matt kaiser
Greenhorn

Joined: Jul 08, 2008
Posts: 2
Well I'm mostly a PHP person, but i'm still not very experienced.

I have a upload section and control panel. In the control panel, the user can view the file's info. (mainly jpegs and pdfs) I want to have a button (or text) to be able to save the file to their harddrive. The people that will be using the control panel arent very well educated with computers. It needs to work on Mac too.

I don't know what coding language this is possible in, if it is possible at all. But I really need this to work because I have a deadline for this.

Thanks a lot.


~DJMK93
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi Matt,

Welcome to JavaRanch!

There are two pieces to the solution: a little server-side component, and a simple link on the web page. The server side component just has to return the document you want, but with the content type set to "application/x-unknown" or something else undefined. The component would take the name of the document to return as a parameter. I don't know PHP, but I imagine this is simple to do; a Java servlet or JSP to do it would be just a few lines.

Then on the web page itself, you just need an HTML link to that server-side component, providing the document name. When the browser sees the data coming with the unknown content type, it will ask the user to save it to a file, since the browser won't know what to do with it otherwise.
[ July 09, 2008: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
matt kaiser
Greenhorn

Joined: Jul 08, 2008
Posts: 2
Thanks but I really need a code. It doesn't need to be php. It can be javascript, etc.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by matt kaiser:
Thanks but I really need a code. It doesn't need to be php. It can be javascript, etc.


Well, it does have to be PHP, if that's what the back-end is written in. As I said, you need a simple file-serving component that runs on the server. Javascript would run inside the browser, and that would be no help at all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Save as button on web page