Archive

- Posts Tagged ‘file’

URI vs URN vs URL

Do you know what does URI, URL and URN means? I bet you will say that I know about URL but what about URI and URN! Here is a good description on Wikipedia and that is enough to understand these three: URI tells a unique path to a resource on… (Continue)

Handling File Read/write Concurrency Problem in PHP

Recently I need to use file for caching little bit of data. Then I thought of concurrency problem can arise in File based structure due to read/write issue. For small data and that also if  not so useful , usage of Database can be avoided. Though Database can handle any… (Continue)

PHP: Getting File extension and file basename

Here is a script for getting file extension. It will take care of the file name like this: yourfilename.inc.php etc and not only filename.inc or fileename.php. It will get your last part of file irrespective of how many dots in file. <?php // will get the file name out of… (Continue)

PHP require/include and relative path error

It is little difficult to get the right path in PHP sometime. PHP gets the path based on top page. To get the right path two functions are very useful - getcwd() and realpath(). To get what PHP is understanding of your supplied path for require/include, use realpath(). It will… (Continue)

Getting all Parent Folders of a Folder and File

I need to get all the parent folders of a File for a work. I searched on net to find easy solution for this and also to find some tips for my work. As, my work was heavily dependent on this logic, so I have given some time to it.… (Continue)