SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Phil-man's Avatar
    Join Date
    Nov 2000
    Posts
    291
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi:

    Two-part question here:

    1) Not sure if this is possible or not. Perhaps it's even easy, I don't know. Suppose I have a link to a file called "thisisthetext.txt". When a user clicks on the link, I need the browser to open a "Save As" dialog box and NOT read the file in the browser. Unfortunately, changing the file/extension isn't an option for me in this case. It has to stay as is (don't ask why...).

    2) This part is bizarre... once you get the browser to open a "Save As" dialog box, is it possible to write a different string to the "File Name" field in the dialog box? I know you're probably thinking "the user can just change it to anything they want", but it's actually not an option in this case.

    So, in short, a user clicks on a link to a file called "thisisthetext.txt", a "Save As" dialog box opens up with something like "text123.txt" in the File Name field, and the contents of thisisthetext.txt are stored on the users hard drive as text123.txt.

    Is this possible? I have PHP and JavaScript at my disposal. Even if they aren't both possible, any help with either one would be greatly appreciated. Thanks!

  2. #2
    SitePoint Evangelist mad-onion's Avatar
    Join Date
    Aug 2000
    Location
    Land of the long white cloud
    Posts
    556
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As far as im aware you could do that by making .txt not a recognised mime type.
    How that is done i am not sure but someone will know, probably just have to place a line in the .htaccess file...

    I THINK
    SiteOptions >> Services :: Products :: Contact
    Developers of PHP, C++, Visual Basic, MySQL, and more!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •