[thelist] Free Tip for PHP

Rob Smith rob.smith at THERMON.com
Mon Jul 21 09:17:59 CDT 2003


<tip type="Getting File Names from <input type="file"> fields with PHP"
I made neat script that will/should help with file uploading and the <input
type="file"> button. I wanted the file name so I did this:

(complete file path is set via method="GET" in my form and the file fields
name is "Info")

$Info = $_GET["Info"];
$Info = split("\\\\",$Info);

echo $Info[count($Info)-1]; // get the file name 

and the output was in fact:

original path:
C:\Documents and Settings\...\My Documents\file.htm

The nice thing about this is that it will grab the file name regardless of
how long the file path is.


More information about the thelist mailing list