I wonder if there will be a security flaw in this approach. I am writing a piece of code that allows users to upload files and another set to download these files. These files can be any.
Is there a way anyone can use the above scenario?
, . . , , , , .
-, PHP ( , readfile() ), , . apache, , - .htaccess " " , . , , ( - ).
readfile()
-, , . , ? , , ( , ). , , - (, auto_increment). , ( , , , mysql_last_insert_id())
mysql_last_insert_id()
, , , , , .
include/require - , , .
include
require
, , .: -)
, .
, , , , mime Content-Disposition. , PHP ( open_base_dir).
, , .
.
If this is another extension that does not execute by default and has a random hash, it is guaranteed not to be used. Just make sure you are not assigning PHP to the extension.
I would suggest that you rename the file extensions to not executable, so even if there is a loophole in security, and someone can access the file, they will not be able to execute it. Other than that, I see no way that anyone could compromise security.