SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    File redirect with name change

    I'm a beginner trying to set up a PHP script that tracks a download request and then allocates a new name for the file before redirecting the file to the browser. I've managed to get it working using header() with "Content-Type" "Content-Disposition" and fread() etc. and everything seems fine.

    However, the files are stored on an Amazon S3 account in order to reduce bandwidth on our server and it occured to me that the file will be read onto our server before being sent out to the browser. Am I correct? Obviously this is no good as it will effectively be downloading the file twice.

    Is there any other way that I can redirect the browser to the file and simultaneously change the filename to whatever I want the browser to see?

    Thanks for any help you can give me!

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Try
    Code php:
    header('Location: http://example.com/path/to/file');

    I've no idea about Amazone S3 though, but this obviously won't work if there's some kind of authentication used.
    Saul

  3. #3
    SitePoint Member
    Join Date
    Jan 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. That would work for the redirection to the file, but wouldn't allow me to specify a different name. I'm going to go about things differently but I'll keep an eye on this thread if anyone has any other tips for me.
    Last edited by Jelena; Jul 22, 2007 at 13:36. Reason: test


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
  •