Quantcast
Viewing all articles
Browse latest Browse all 4

Answer by 24Ahead for Why does PHP store uploaded files in a temporary location and what is the benefit?

Two additional reasons:

  1. If you decide not to accept the file for some reason, it's stored in a temporary location and presumably will be automatically deleted at some point.

  2. Security. Let's say PHP was set to upload to a web-accessible directory like /images. Someone could upload some sort of hacking file and then execute it. By putting files in a temporary directory first (which will usually not be web-accessible), PHP lets you examine the file first. For instance, by processing images to remove any comments that could contain PHP code.


Viewing all articles
Browse latest Browse all 4

Trending Articles