Use an .htaccess file in the folder(s) you want to have protected, and add the following: <FilesMatch "\.(pdf|jpe?g|png|gif)$"> Order allow, deny Deny from all </FilesMatch> That will make them inaccessible from direct linking etc, but still available to use from within your scripts
thank you for answer . I had already thought to htaccess , but some hosting do not allow then how can you do the other tips?
Use another host. Seriously. A host that does not allow .htaccess, or your own setup in any way, is not really worth it. Apart from that, there isn't all that many ways to protect certain files from being available - you can of course put them all in a database, and access them from there, but that is a clunky and slow solution.
Then store them below the "root" so that there is not url to them and they have to delivered via a script. But if these files have value to you then the cost of decent hosting is worth paying.