• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 229
  • Last Modified:

Creating a Directory.

hi,

I'm trying to create a directory, using the name of the course entered in a textbox as the name for the directory.

The name of the course can have any caracter, including those that the directory name don't accept. But I want the directory to be created always.

How can I pull off the invalid caracters to create the directory, I mean. If the course name is   "Administraci√≥n?<>/Estrategica", I want the directory "administracionestrategica" to be created.

Thanks in advance for your help

bye!
0
lavinchuca
Asked:
lavinchuca
1 Solution
 
jaxnCommented:
I will use $course as the variable name.

// Strip PHP tags and escape shell metacharacters
$course = escapeshellcmd(strip_tags($course));

// Convert to all lowercase (per your example)
$course = strtolower($course);

// Make the directory
mkdir($course);



Your directory is now created
0
 
lavinchucaAuthor Commented:
I found this.. do it works better???

$course = strtolower(ereg_replace("[^[:alpha:]]", "", $course);

this leave only the letters in the course name. So I won't have any problem creating a directory.

...or may I have it?????

who knows...

What means aka????

bye!!!

sorry my english.
0
 
VGRCommented:
aka means "also known as"

this is a synonym for "alias"
0
 
jaxnCommented:
The version I posted will allow legitimate characters to be in directory names.  This means if they entered Course_One it would create the directory course_one.

-Jackson
0
 
snoyes_jwCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I will leave the following recommendation for this question in the Cleanup topic area:
    Accept: jaxn {http:#8213555}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

snoyes_jw
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now