I have this little thing that creates a file and names it in accordance with the file title. It forces everything to lowercase, and replaces punctuation marks with hyphens while using the file title for file name.
For example, file with the title
[b]How is this, OK?
gets to be automatically named
[b]how-is-this–ok-.php
here is the line that does replacement.
[code=php]$thisFileName = trim(strtolower($_POST[‘file_title’]) );
$thisFileName = str_replace(“.”, “-“, $thisFileName);
I just used the period sign . to demonstrate, I’ll spare you the other dozen of punctuation marks.
now, considering it’s creating and naming the file, how do I handle quotation marks (both single and double?)
Singles insert the slash right into the file name, and I end up with files named like:
for
[b]File’s Name
I get
[b]file–
doubles “break” the code altogether.
Now, my title (File’s Name), is OK; it stores in the database properly, and displayed OK. The actual PHP file it corresponds with gets to keep the slash…
I know a little php, a little enough to be a danger to myself ? so I don’t get some simple things, obviously.
Please, help with this matter.