Jump to content

Is there difference between direct download vs download trough PHP script?


rain13

Recommended Posts

I have question.

 

 

 

Is there difference in performance when I compare direct file download to download trough php script?

 

By direct download I mean site.com/photos/file.jpg

By download trough PHP I mean site.com/download.php?file=123

 

Am working on web gallery. If offer downloads trough direct link, then I dont need to run php script but I cant have control over downloads and actual file names in server would be revealed. From the other hand if I use php script such as download.php then I would have more control over access and actual file path would remain hidden. Now I am wondering if there is any difference performance wise whether I use direct link or php script? I mean thumbnails page would generate many requests and thats why I am wondering if there is any difference between these 2 options.

Link to comment
Share on other sites

I think it depends, i mean surely you can use both but is you use direct download "URL/photo.png", the user will have a direct access download-link to download by himself while a PHP download would use more performance in first reading the code and THEN the user would be able to download the image.

 

There are many areas to take into consideration if you ask me, things like how many people are gonna use you website etc, it all depends on how many times the PHP script has to be run compared to the easier way of just giving a direct link to the image-download-link to the user?

 

If you would ask me i would probably give a Direct link? :)

 

Hope this helps.

Regards, rootKID ;):P

Link to comment
Share on other sites

The performance difference is negligible. The PHP executes hundreds or thousands of times faster than it takes to transfer the file's actual data, the time difference is measured in microseconds.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...