![]() $srcFile = getRelativeDirectory($from, $to) //basicly a function which will find the from -> to, but in this case the from ist the target where you need to start.īelow you can find some examples how to split the path in chunks to find a relativ pathīe warned that at least with php 5.3 on windows 2008 R2 the symlink function is effected by the statcache. This you can find out e.g.: when having the absolut path of source and target: "/myfiles/now/here/././later/" and links should go to /myfiles/later/ you need to use realpath( dirname() ) set the new location using chdir() and start from here to link to the source which is. If you start to create the target path from the source eg: You need to create/find out the relativ path to the source, otherwise the absolut path will be used in a link. Manpage says: the target is the _linkname_ and from that point to create relative links successful is to start from the directory where the link should be created e.g.: Sym/hard linking i love to do it relative a lot but not that trivial when thinking wrong :-) This is not too great if not many people download the file since the symbolic link will not be deleted until another person downloads the same file. There appears to be no problem if a symbolic link is deleted while another person is downloading from that link. This in effect leaves only one symbolic link at a time and prevents past users from downloading the file again without going through this script. The code also deletes any past symbolic links created by any past users before creating one for itself. ![]() The browser is then redirected to the new link and the download begins. ![]() The way this works is when a user wants to download a file, a randomly named dir is created in the $downloaddir, and a symbolic link is created to the file being requested. You will have to set: $filename, $downloaddir, $safedir and $downloadURL.īasically $filename is the name of a file, $downloaddir is any dir on your server, $safedir is a dir that is not accessible by a browser that contains a file named $filename and $downloadURL is the URL equivalent of your $downloaddir. ![]() ![]() Here is a simple way to control who downloads your files. Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Supported Protocols and Wrappers Security Introduction General considerations Installed as CGI binary Installed as an Apache module Session Security Filesystem Security Database Security Error Reporting User Submitted Data Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and Archive Extensions Cryptography Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation GUI Extensions Keyboard Shortcuts ? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto search ![]()
0 Comments
Leave a Reply. |