Entries from February 2005 ↓
February 24th, 2005 — phpcollab
phpCollab was inserted in the application db of OpenSourceExpert.com.
This is a site where a clients/companies who need/want paid support can find that.
Being listed is of course free as our things like announcing phpCollab Bounties, Call for Tenders, Jobs, etc.
so, if you are phpC gurus or desperatly need some what are you waiting for? subscribe now!
Continue reading →
February 17th, 2005 — php
The new incoming release of PHP (4.3.11) has a different behaviour on file name upload with IE. While uploading a file using IE the $_FILES[‘myfile’][‘name’] variable returns the entire upload path and not only the file name.
In example
- firefox: $_FILES[‘myfile’][‘name’] = prova.txt
- IE: $_FILES[‘myfile’][‘name’] = c:\misc\prova.txt
A possible solution should be to parse the name of the file using the basename function. But this is only an incomplete fix because with Linux the backslash is allowed inside a file name. So a complete fix (also back compatible) is:
[php]
$filename = str_replace(”, ‘/’, $_FILES[‘userfile’][‘name’]);
if (get_magic_quotes_gpc()) {
$filename = basename(stripslashes($filename));
} else {
$filename = basename($filename);
}
echo $filename;
[/php]
Note the use of the stripslashes() function to remove unnecessary data if the magic_quotes_gpc is enabled on the php.ini
Some references: