RE: [PHP] + in filenames

From: Date: Sat, 25 Jan 2003 22:36:26 +0000
Subject: RE: [PHP] + in filenames
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133139@lists.php.net to get a copy of this message
I DO want preserve the filenames, and the pluses come from the user (beta testers that deliberately try to hack the script) . all I want to do is make sure the the script doeasnt breack when a user uploads a file that has the + character in it's name. - Vic -----Original Message----- From: Richard Whitney [mailto:rw@xend.net] Sent: Saturday, January 25, 2003 5:32 PM To: Victor Cc: php-general@lists.php.net Subject: RE: [PHP] + in filenames Victor! What are you trying to accomplish? Do you want to preserve the original filename? Why not give uploaded files uniformly unique names? In other words, where are the +'s coming from? So, a little more detail, please! RW Quoting Victor <siliconhype@yahoo.ca>: ### Here is some sample code: ### ### ________________________________________________ ### ### $file_name = explode(".", $_FILES['picture']['name']); ### $name = str_replace('', '_', $file_name[0]); ### ### # check if file uploaded is good ### if ### ( ### !in_array($_FILES['picture']['type'], ### $file_type) ### || trim($_FILES['picture']['tmp_name']) == "" ### || trim($_FILES['picture']['tmp_name']) == ### "none" ### ) ### { ### echo ('You can upload a JPG or JPEG filetype ### only.'); ### ### exit; ### } ### ### # Add slashes to prevent certain errors ### $picture_name = strip_tags($_FILES['picture']['name']); ### $picture_name = addslashes($picture_name); ### $picture_name = str_replace("\r\n", "", $picture_name); ### $picture_name = str_replace(" ", "", $picture_name); ### ### ____________________________________________________ ### ### -----Original Message----- ### From: Richard Whitney [mailto:rw@xend.net] ### Sent: Saturday, January 25, 2003 5:12 PM ### To: Victor ### Cc: php-general@lists.php.net ### Subject: Re: [PHP] + in filenames ### ### Some sample code would help, but maybe try urldecode('$filename'); ### ### RW ### ### Quoting Victor <victor@argilent.com>: ### ### ### I have a file upload field, and some filename checking code, but it ### ### breaks the code whenever a + is inside the filename it verifies ### space ### ### and other tags but breaks on + in the name. Anyone know a fix for ### this ### ### please? ### ### ### ### - Vic ### ### ### ### ### ______________________________________________________________________ ### ### Post your free ad now! http://personals.yahoo.ca ### ### ### ### -- ### ### PHP General Mailing List (http://www.php.net/) ### ### To unsubscribe, visit: http://www.php.net/unsub.php ### ### ### ### ### ### ### -- ### Richard Whitney ### Transcend Development ### Producing the next phase of your internet presence. ### rw@xend.net ### http://xend.net ### 602-971-2791 ### ### -- ### PHP General Mailing List (http://www.php.net/) ### To unsubscribe, visit: http://www.php.net/unsub.php ### ### ______________________________________________________________________ ### Post your free ad now! http://personals.yahoo.ca ### ### -- ### PHP General Mailing List (http://www.php.net/) ### To unsubscribe, visit: http://www.php.net/unsub.php ### ### -- Richard Whitney Transcend Development Producing the next phase of your internet presence. rw@xend.net http://xend.net 602-971-2791 ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca

« previous php.general (#133139) next »