Web Analytics Made Easy -
StatCounter quick question about php headers - CodingForum

Announcement

Collapse
No announcement yet.

quick question about php headers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • quick question about php headers

    hello, I have a quick question about php headers.
    Say if I use something like this to download a file:
    PHP Code:
          header("Content-type: application/pdf");
          
    header("Content-Disposition: attachment; filename=file.pdf;" );
          
    header("Content-Length: "size); 
    Will this waste my servers bandwidth or the server that I'm downloading the content from?
    Thanks in advance.

    Thanks

  • #2
    Quick answer:

    Yup.

    Longer answer:

    Anything that is downloaded from your server = bandwidth...period.

    Comment


    • #3
      PHP Code:
      header("Content-Length: "size); 
      Be aware, you're missing a concatenation operator '.' there. That's a syntax error waiting to happen.

      Comment


      • #4
        Originally posted by SP360 View Post
        hello, I have a quick question about php headers.
        Say if I use something like this to download a file:
        PHP Code:
              header("Content-type: application/pdf");
              
        header("Content-Disposition: attachment; filename=file.pdf;" );
              
        header("Content-Length: "size); 
        Will this waste my servers bandwidth or the server that I'm downloading the content from?
        Thanks in advance.

        Thanks
        I'm sorry but I don't understand the question. You want or not to allow your visitors to download the pdf? If you want what sense have to ask if this waste server bandwidth?

        best regards

        Comment


        • #5
          Hi there,
          The file is located on a different server. The URL will be passed along side the headers above. Then it will be downloaded.
          So what I want to find out exactly if the file is not located on my server but called from my server and outputted through the headers, will that waste my bandwidth?

          Thanks

          Comment


          • #6
            Originally posted by SP360 View Post
            Hi there,
            The file is located on a different server. The URL will be passed along side the headers above. Then it will be downloaded.
            So what I want to find out exactly if the file is not located on my server but called from my server and outputted through the headers, will that waste my bandwidth?

            Thanks
            that make sense. Maybe 2.2 from this link will help you:

            http://www.ietf.org/rfc/rfc2183.txt

            I never ask myself what happend in this case so I guess,
            if user decide to download the attachment the bandwidh will be affected else not affected.

            best regards

            Comment

            Working...
            X