?
Solved

Creating a Directory.

Posted on 2003-03-26
6
Medium Priority
?
228 Views
Last Modified: 2006-11-17
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
Comment
Question by:lavinchuca
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Accepted Solution

by:
jaxn earned 200 total points
ID: 8213555
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
 

Author Comment

by:lavinchuca
ID: 8213623
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
 
LVL 15

Expert Comment

by:VGR
ID: 8214616
aka means "also known as"

this is a synonym for "alias"
0
 

Expert Comment

by:jaxn
ID: 8214835
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
 
LVL 33

Expert Comment

by:snoyes_jw
ID: 11942631
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question