08-27-2009, 05:08 AM
Now correct me if I am wrong. But with PHP you should be able to do this:
$imagename = basename($_FILES['filename']['name']);
And just get the name of the image? So for am example the file was named 'example.jpg' it would show 'example'.
08-27-2009, 05:15 AM
No, basename just gets the name of the file unless you set the second parameter:
// Outputs image.jpg
echo basename('really/long/path/image.jpg', '.jpg');
// Outputs image
08-27-2009, 05:18 AM
Is there a function that will do this?
08-27-2009, 08:21 AM
pathinfo may work on an upload, you'll have to test it out:
$sFileName = pathinfo($_FILES['filename']['name'], PATHINFO_FILENAME);
Not certain if the pathinfo will work properly for you, but only one way to find out. Basename will work fine if you know what the extension is on it, but if you allow different image types, that won't work out.