Re: Need help...silly customer

From: Date: Tue, 14 Nov 2000 21:53:58 +0000
Subject: Re: Need help...silly customer
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-25255@lists.php.net to get a copy of this message
Yep, you could use ereg(i)_replace(); also, but for simple single string replacements using str_replace() is generally faster. If you wanted to replace a bunch of illegal characters you would want to do this: $image_name = 'sofa-&#-b.jpg'; $image_name = ereg_replace("[&#\ ]",$image_name); All &'s #'s and spaces will be deleted. --Joe On Tue, Nov 14, 2000 at 04:51:56PM -0500, Shane McBride wrote: > So I should put this in the script that uploads and writes the file correct? > > So that I understand: > > $image = "sofa #184-B.JPG" > becomes: > $image = "sofa 184-B.JPG" > after using: > str_replace('#', '', $image) > > Thanks, > Shane > > ----- Original Message ----- > From: "Joe Stump" <joe@earth.care2.com> > To: "Shane McBride" <php@riversidedesigns.net> > Cc: <php-general@lists.php.net> > Sent: Tuesday, November 14, 2000 4:37 PM > Subject: Re: [PHP] Need help...silly customer > > > > str_replace('#','',$image_name); > > > > That'll teach her to mess with a coder that has complete control over her > > application ;) > > > > --Joe > > > > On Tue, Nov 14, 2000 at 04:26:17PM -0500, Shane McBride wrote: > > > OK, I have the customer from hell here. I created a script for her that > allows her to add featured items, including an image. > > > > > > I tested it pretty well, except that all the images that the php script > uploads has no special characters. So, she uploads an image that has a > special character in the name and the image link won;t work. Of course. > > > > > > what happens is that the image uploads and puts a time stamp in front of > it. I thought that was nice since she could have duplicate image names. > > > > > > At this point the whole name is written to the database with the proper > spaces and special characters. > > > > > > When the file is moved to the correct directory by the script, the name > is maintained with the spaces and special characters. > > > > > > The problem is the number sign she insists on using!!!! She wants to > name them "Sofa #184-8.JPG". > > > The browser must interpret the # sign as something else. I can not > remember the name of that. > > > > > > Is there a way around this? > > > > > > TIA, > > > Shane > > > > > > ============================================================================ > ==== > > = Joe Stump joestump98@yahoo.com > http://www.miester.org = > > > ============================================================================ > ==== > > "Real programmers don't comment their code. > > It was hard to write, it should be hard to understand." > > ================================================================================ = Joe Stump joestump98@yahoo.com http://www.miester.org = ================================================================================ "Real programmers don't comment their code. It was hard to write, it should be hard to understand."

« previous php.general (#25255) next »