简体   繁体   中英

getting path from the Save As Browser Dialog box

I am working on an app that is using jQuery, and php. I want to prompt the user with a Save As dialog that already has the filename that I want to save the data to. Now, there have been quite a few posts on this subject that use the following:

header('Content-disposition: attachment;filename=whatever.dat');

There is another technique that I have seen:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns='http://www.w3.org/1999/xhtml'> 
  <head>
    <title>iframe downloader thingy</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script type="text/javascript">
      $(document).ready(function() {
        $('a#linky').click(function(){
          var iframe = document.createElement("iframe"); 
          iframe.src = 'http://cl.ly/120d44203F223O1X2T43/example_branding.zip'; 
          iframe.style.display = "none"; 
          document.body.appendChild(iframe);
          return false;
        });
      });
    </script>
  </head>
  <body>
    <a id="linky">Click to download</a>
  </body>
</html>

I need to have the entire path that the user selects from that Save As Dialog returned to me for further processing in a php server script. What I am trying to do is to take some MySQL data and save that data as a comma delimited text file as an input to Outlook or Thunderbird mail client.

Hopefully, I have explained this clearly. Thank you

Ed Cohen

I'm gonna go ahead and save you a ton of time here - there's absolutely no way you can access that little line of text on the browser's "Save As" dialogue. What you CAN do though, is get the information from the exact same source as the browser gets it.

You should be able to write some PHP code to get the "Content-disposition" header that the download URL supplies the browser, given the URL to the downloadable file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM