Tag Archive | "filename"

PHP : Strip filename from a URL

Saturday, April 26, 2008

3 Comments

ShareUsing PHP, you might need to strip the path from a URL, leaving behind just the filename at the end of the URL. You can achieve this with a regular expression pattern of course, but I have a much simpler solution. See the example code below.

Continue reading...

PHP : Strip or find a file extension

Saturday, September 29, 2007

3 Comments

ShareGetting a file’s extension is essential when working with uploads and other manipulations complying with files. You might have a user uploading a file and you need to rename the file before moving it from the temporary upload directory. In order to do so, you can obtain the file extension and then rename it to [...]

Continue reading...