General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 28th, 2003, 07:00 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
replacing specail chars in filenames

Hi,

How do I replace certain 'special' characters with a '_' in php ???

I need to replace @£!$%^^%&(*) etc as jpegs won't load in flash if they have any of these characters in there. If I convert them to unicode will that work ?? I could convert them to unicode after they're saved in the php file that outputs the XML file that flash parses, but I don't know if you can have unicode in filenames.

Any ideas ??

Thanks in advance,

Jon

Reply With Quote
  #2  
Old June 28th, 2003, 07:04 AM
jben.net jben.net is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 51 jben.net User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 41 sec
Reputation Power: 6
Send a message via AIM to jben.net
I've just checked on the server and it's replacing any of these chars with a '_' itself, but the php is storing the filename in the DB with the @ so the filename is wrong, dam.

Jon

Reply With Quote
  #3  
Old June 29th, 2003, 11:02 AM
delianze delianze is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 1 delianze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hey, i suggest you use make a md5 hash of the filename.

in php i would look something like this:

$filename = "anyfile.jpg";
$md5filename = md5($filename);

if (!copy($filename, $md5filename)) {
die("failed to copy $filename...");
}

that way, you can parse the filename anywhere and if you need a random filename then replace $md5filename with this:

$md5filename = md5(uniqid(rand(),1));
(though i don't think it will be usefull in your case)


hope it helped you!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > replacing specail chars in filenames


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT