File-handling; Special Characters In Folder Names?

Feb 7, 2010

I am using rename() to move a file from one folder to another with php.It works fine with folders which don't have the swedish å ä ö characters involved.Is there any way around this? (except for changing the folder names to something without special chars)


Special Characters In File/folder Names On Linux; Rename Function Not Working?

Jun 3, 2010

I am using a function Rename() (php) to move some images from one folder to another. The destination folder has special characters in them.However, when doing this on the server I get the error that the folder isn't found with the name. And in that error, the folder names special characters are replaced with Squares:

Warning: rename(../temp_images/668635375_1.jpg,../ad_images/B�tar/thumbs/668635375_1.jpg)
[function.rename]: No such file or directory in /var/www/etc....

It works on my local machine though (windows xp)

View 2 Replies View Related

Removing Special Characters If They Are Not Part Of The Tag Names?

May 9, 2011

I am trying to edit html code using regular expressions.

Html code is something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="" xml:lang="en" lang="en">


I woud like to replace all the special charecters with entities nut not if they are part of the tag names.

For example in the quates woud not be replaced but in "egsge" they woud be.

View 2 Replies View Related

Regex For Names With Special Characters (Unicode)?

May 11, 2011

I have read about regex all day now, and still don't understand it properly. What i'm trying to do is validate a name, but the functions i can find for this on the internet only use [a-zA-Z], leaving characters out that i need to accept to.I basically need a regex that checks that the name is at least two words, and that it does not contain numbers or special characters like however the words can contain characters likeand so on...An example of an accepted name would be: " "André Svenson"An non-accepted name would be: "Hans", "H4nn3 Andersen" or "Martin Henriksen!"If it matters i use the javascript .match() function client side and want to use php's preg_replace() only "in negative" server side. (removing non-matching characters).But as the page from LightWing's answer suggests, i'm unable to find anything about unicode support for javascript, so i ended up with half a solution for the client side, just checking for at least two words and minimum 5 characters like this:

if(name.match(/S+/g).length >= minWords && name.length >= 5) {

An alternative would be to specify all the unicode characters as suggested in shifty's answer, which i might end up doing something like, along with the solution above, but it is a bit unpractical though.

View 4 Replies View Related

Variable / Function / Class Names Using Special Characters?

Jun 15, 2011

I understand that the underscore _ is an acceptable character for naming variables / functions / classes etc. However I was wondering if there are any other special characters which can be used. I tested out a few with no luck and have assumed for a long time that there are not, however I figured I would see if anyone else knows for certain. This would be mostly for aesthetic purposes, however I imagine a special character naming convention would be useful when working with other developers to define value types etc.

View 4 Replies View Related

DOMXpath->query() Returns Weird Characters When Source File Has Special Characters?

May 17, 2009

I am scraping HTML and XML information. When the HTML is queried with DOMXpath->query() weird characters are returned when there are special characters. For an example, the characters are returned when there is a character. I have the database collation set correctly, and that's not the problem. The sites I am scraping from have improper (unescaped) entities, and it seems that DOMXpath isn't flexible enough to capture these characters correctly. I don't want junk in my database.Is there a way to fix this, or should I just scrape things using a RegExp instead of using the DOMXpath. Wouldn't scraping with a RegExp be faster anyway? Would I avoid messed up characters if I do it this way? I want to see if there is a way to fix my problem before rewriting portions of my scripts.

View 5 Replies View Related

Reading File Names From A Folder?

Mar 15, 2006

have a bunch of uploaded files in a folder. Now I want to be able to get the names of these files that are stored in the folder using PHP so that can I create direct links to each file from my page. ie can PHP read the names of files from a folder?

View 3 Replies View Related

Display File Names From A Folder?

Nov 3, 2008

I'm using this script to display all the images in a folder, but I can't figure out how to get each image's file name to display underneath it.

$dirname = "images";
$images = scandir($dirname);


View 2 Replies View Related

Read File Names Within A Folder?

Jun 25, 2010

how can i get the php to read the all the file names within a folder and put the names into an array?

View 6 Replies View Related

File Name With Special Characters Like Not Found

Oct 16, 2009

I have a folder on my website just for random files. I used php opendir to list all the files so i can style the page a bit. But the files that I uploaded with special characters in them don't work. when i click on them it says the files are not found. but when i check the directory, the files are there. seems like the links are wrong. how i can get a correct link to these file names with special characters in them?

View 2 Replies View Related

Parsing Out A File Using Special Characters

Apr 19, 2007

I am creating a site where someone would enter data into a few text boxes, with the potential for them to be fairly long. I am therefore saving them into a text file instead of a database.

With these, there is a potential for someone to use the enter key in these boxes, therefore making it very difficult to just parse it out by line.I am currently trying to figure out how to parse it by special characters (or groups of characters such as "%%$$%%" or something that noone would ever type, on purpose or by accident)

I was wondering if there was a way to parse this out by these special characters, or if there was a way to save those line returns that the people enter as something other than a line return.

View 8 Replies View Related

Upload File With Special Characters

Oct 18, 2007

I have an upload script that works great except for when a file with special characters is used. If   eric'sfile.txt is uploaded it will do this  eric'sfile.txt  is there a way to have it remove the special characters instead?

//path to storage
$storage = 'Files';

//path name of file for storage
$uploadfile = "$storage/" . basename( $_FILES['Filedata']['name'] );

//if the file is moved successfully
if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $uploadfile ) ) {
echo( '1 ' . $_FILES['Filedata']['name']);

//file failed to move
echo( '0');

View 6 Replies View Related

Use Special Characters Or Spaces In The Video File.

Jun 26, 2007

Ok this is my problem. Im running a website that uses a youtube clone script i bought the code it all works, the problem now is when i wanna upload a video it doesn't let me use special characters or spaces in the video file.

For example

my first - video.wmv wont work

myfirst-video.wmv will work

View 14 Replies View Related

Reading Data From File Special Characters?

Jan 15, 2011

My previous question and this question both are related a bit. please have a look at my previous question I did not found any other way to unserialize the data so coming with the string operation.I am able to get the whole content from file but not able to get the specific string from this content.

I want to search a specific string from these content but function stop working when the reach at first special character in the string. If I am searching something found before the special character the works properly.String operation function of PHP not working properly when the encounter first special character in the string and stop processing immediately, Hence they does not give me the correct output.

Originally they looks like (^@)

:"Mage_Core_Model_Message_Collection" but when I did echo they are display as ?

Here is the code what I tried


I changed the default_charset to iso-8859-1 and also utf-8 but not working with both

View 1 Replies View Related

Read File Names From Folder Only Keep Files With .iso Extention?

Mar 29, 2011

I have a script that gets a string from a config file and based on that string grabs the file names of a folder.

I now only need the iso files. Not sure if the best way is to check for the .iso string or is there another method?

// Grab the contents of the "current.conf" file, removing any linebreaks.
$dirPath = trim(file_get_contents('current.conf')).'/';
$fileList = scandir($dirPath);


View 3 Replies View Related

Generate Short And Unique File/folder Names?

Apr 30, 2009

The criteria is basically this:

folders will exist for about 24-48hrs
folders names can not be readily guessable by a user (if used in a URL)
folder names should be short 5-15 chars
Initial thoughts:

When uploading a file, I basically want to keep the unique file name as named by the uploader, so to avoid any naming collision I would like to put it in a uniquely named directory

View 8 Replies View Related

File Get Contents - File_get_contents().. Doesn't Handle Special Characters?

Apr 4, 2010

I've got an HTML file with special characters such as:

AT&T™ Official Site

When I use file_get_contents() on the file and echo the contents, I get something like this: AT&Tu00e2u0084u00a2 Official Site.How can I convert the latter to the former? This is all I'm running:

echo file_get_contents("http:[url].........

View 2 Replies View Related

TCPDF HTML With Special Characters Displays Empty PDF File

Nov 10, 2010

I am using TCPDF Library Version: 5.9.011. I am trying to execute HTML layout as PDF. For which I tried with example provide with the site

$html = '<h1>HTML Example</h1>
Some special characters: &lt; € &euro; &#8364; &amp; è &egrave; &copy; &gt; \slash \\double-slash \\\triple-slash
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');
//Close and output PDF document
$pdf->Output('example_006.pdf', 'I');

Apparently found that generated PDF only default header and footer with middle content blank. However if I remove special characters like:


PDF gets its middle content as specified in $html Am I missing something or doing something wrong?

View 2 Replies View Related

Replace Special Characters By Non-special Characters

Jul 17, 2005

i'm looking for a way to replace special characters with characters
without accents, cedilles, etc.

View 17 Replies View Related

Sorting An Array Of Folder Names For Displaying The Content Of A Folder?

Jun 30, 2010

I have wrote a function for getting all the subfolders of a folder. It also has the option of going the an upper level and displaying the folders....much like a file manager but it works only for folders and has a restriction to not go upper than the base folder so to prevent users from browsing the entire hard disk. am returning the result as a json object to be put in a div. My problem is this: On my windows box (using wamp) the folder "Up one Level" is always displayed on top of the folder list. When I upload it on my website it doesn't display on top but somewhere in the middle. I have wrote a function ( fixArray($array) ) to correct this...but it doesn't seem to work. The entire solution for this feature is provided so please help to make it work and for others to benefit from it.Just to mention: there is nothing wrong in the JS code. JSON object is parsed in the order it is sent by the php file.

function fixPath($path) {
$path = str_replace('/../', '/', $path);
$path = str_replace('/./', '/', $path);


View 2 Replies View Related

Read A Folder And Split Sub-Folder Names Into MySQL Inserts?

Jul 14, 2011

I have a folder named "Comics" and sub folders in that directory with the names of comics + the issue

/Comics <-- Main Folder
/Amazing Spider-Man 129 <-- Sub Folder
/Hellblazer 100 <-- Sub Folder
/Zatanna 01 <-- Sub Folder

Now what i want to do is scan the Comics directory and output each folder name as a mysql insert query. The actual folder name needs to be seperated as "Comic Name" & "Comic Issue".Example Querymysql_query("INSERT INTO comics (name, issue) VALUES ('Amazing Spider-Man', '129')");I got this far and now i want to add a query check to see if the comic exists or not.

$main_folder = 'K:/Comics/'; // should be K:Comics but I changed it because of the highlighting issue

View 2 Replies View Related

Reg Ex Validation On UTF8 / Multi Byte 'language' Characters (inc Chinese Etc) But Not Special Characters Such As {/*?

Aug 26, 2010

Using PHP / Mysql all encoded up as UTF we have recently had to start capturing non-Latin characters such as Chinese etc.We have php validation that checks on string length and alpha numeric such as

if (!ereg("[[:alnum:]]{2,}",$_POST['company_name'])) {
//error code here


View 3 Replies View Related

Check Special Characters And Change To Normal HTML Characters

Feb 10, 2001

I'm writting a news management script and I have run into a problem. When some submits a news artical it sometime contain special characters that might now show up on all browsers. Is there a way to makeit check for the characters and switch them to html that can be read by browsers. Is there a way to do this and name it as like, then just tell the program to just use this inc file before sending the content to the database. I want to be able to use the special character to html lib for other programs.

View 3 Replies View Related

Handling Special URLs In PHP

Jul 17, 2005

I'm creating a classified ad site where each ad is identified by a
number - say 234563. The user wishing to view the ad will something
like this -

I want this url to be redirect to a php display page say -
How does one do this?

View 1 Replies View Related

Special Character Handling

Apr 10, 2003

I have a forum and in add/edit/quote/reply, people can preview what they have entered, but if they entered special charecter like " ' (double or single quote), the php will generate a " ' in the preview and in the form field, so when they submit, the will also appear. How can I handle this.

View 2 Replies View Related

PHP Handling Special Redirections

Nov 7, 2007

Id like to have my host redirect the user on special URLS, much like seen in wikipedia,i.e.,

Ideally, Ill have this redirect url path in my database, wich is a db of several image galleries of various artists. Id like the user to access galleries with this ease, as typing to access Leonardo's gallery. (this is not my actual hostname).

A friend of mine told me I should look up on ISAPI filters, and I did google and read some of it, but am a little lost on the proper procedures to achieve this functionality with PHP.

View 7 Replies View Related

Special Character Handling - XML Feed

May 16, 2006

I have an XML feed which appears to have a bullet in it.

When I parse it in PHP, it turns into a question mark.

I'm completely ignorant on character sets and handling of special characters. I searched around but couldn't find any good resources....

View 6 Replies View Related

Path - Print All Files' Names In The "file" Folder?

Dec 30, 2010

How to print all files' names in the "file" folder using php? /file/

View 4 Replies View Related

Sorting Names By A Special Way

May 31, 2007

I have records named "Entry-1", "Entry-2", .... "Entry-10", "Entry-11", etc... Code:

View 2 Replies View Related

Handling Case Of Field Names In Multiple Db's

Jul 17, 2005

(Bottom line: I think what I'm looking for is an easy way of changing
the case of key values in an array.)

I've got code that I'm trying to make agnostic about the underlying
database system I'm using. That is, I want the code to work whether
the underlying db is MS SQL, MySQL, Oracle, etc. I'm using the PEAR DB
package, and it's great for what I'm trying to do...except in one
area. I get the returned row fields in an associative array, where the
element key is the field name and the element value is the field
value. The problem is that MS SQL returns field names in mixed case
(actually, it returns the field names in the case the user used to
define the field names in MS SQL in the first place), while Oracle
returns the field names all caps. So, if I have the same db on MS SQL
and on Oracle, I can't easily access the field values.
For example:


Now, if I print_r($row), I see something like:

***[Name]*=*"Fred Flintstone";

If I run this under an Oracle db, I might get this, instead:

***[NAME]*=*"Fred Flintstone";

So my code cannot say something such as:


That would work for the MS SQL version, but not for the Oracle
version. I certainly don't want to say something like:


I really don't have control of how the users define the case of their
field names, otherwise I could tell them to upper-case them all the
time. But that might not work, if a different set of db routines that
DB uses returns field names in all lower case.

I could do the following, but I'm not sure I want to take the
efficiency hit (maybe it isn't so bad; I don't know):


View 4 Replies View Related

Javascript And Html : Automatically Generate The Html Code That Shows The Photos By Reading The File Names In The Photo Folder?

Mar 19, 2011

UPDATE:The php code worked perfectly on my PC (wamp server) but i've now uploaded it on a free webhost server and while the php part runs perfectly (it produces the array) the javascript function itself doesn't work cause there are no photos in the website when it's loaded. I tried to test it by putting in the function's first line an alert to see if it runs but never showed up. I think that the server for some reason doesn't realise that it is a javascript function because i also had in the getphotos.php this:

window.onload = photos();

which appart from starting the photos function, shows a text. When i moved that line in js file and put the show text line first, it run showing the text but still no photos.

END OF UPDATE:I want the site to automatically generate the html code that shows the photos by reading the file names in the photo folder, but i need also to use javascript. So I found through the web a solution with php generating javascript which than generates the html code I want and I think this is what I need. But... it doesn't work X_X. Firstly, here is the php/javascript(in getPhotos.php):

header("content-type: text/javascript");
//This function gets the file names of all images in the current directory
//and ouputs them as a JavaScript array[code]....

This is it, and it doesn't work! I know I ask to much by just giving all the code and asking for help but i can't even think what's wrong,

View 2 Replies View Related

Special Characters - Foreign Characters

Mar 16, 2006

I'm experiencing a strange problem in displaying some text I have extracted from an XML file that I haven't had much success in solving. I am retrieving some remote XML, placing it in an array, and extracting the data I need, then inserting that into a MySQL database so it can be manipulated and merged with other data.

Some of the data includes location names, such as the one below, which include foreign characters that have been translated into a special character. For some reason, these are actually being displayed in the form shown below. For example and ampersand appears as &amp; and not as &. PHP Code:

C&#244;te d'Ivoire

View 2 Replies View Related

Special Characters In R And OS PDF?

May 20, 2010

I am using the R&OS PDF library to generate pdf documents in PHP. Living in Italy, unfortunately we have accented characters, which I just cannot manage to generate. I've looked through the instructions, and I found:

'setup the helvetica font for use with german characters

Which I tried, to generate agrave and Agrave (and the big A with an accent).

View 4 Replies View Related

How To Get The Files Names From The Folder Using PHP ..

Oct 23, 2007

How to get the files names from the folder using PHP .. is there any
specific command. If yes let me know that..

View 3 Replies View Related

One Folder Multiple Names?

Jun 2, 2009

I do not know where to start this thread so starting it here.My directory structure on the server is as follows:



View 3 Replies View Related

Displaying Special Characters

Apr 17, 2003

My PHP script uses XML SAX functions to extract data from an XML document. In the XML, I have something like:

<myelement>Steak &amp; Cheese</myelement>

My PHP script extracts the data between the two elements, but when it displays it to the screen, it returns it to HTML as 'Steak & Cheese', but I need it to return 'Steak &amp; Cheese'.

Not to be confused with how it looks on the screen to the user. It SHOULD look like 'Steak & Cheese' to the user, but in the page source generated by my script, I want it to be 'Steak &amp; Cheese'.

View 1 Replies View Related

Can't Echo Special Characters

Dec 2, 2001

A simple form that asks a player Nick, a Quake 3 Nick


^1 = Red
^4= Blue, etc.

Through ^1 to ^8 you get the colors.

For example: ^4<LGG>^2Ozzman Will display: <LGG>Ozzman

The problem is that special characters causes errors or I can't echo the variables correctly. < and > is a TAG for PHP so it disapear when I echo the $nick var.

And what about the ^ or other special characters?

How Can I do this?

View 2 Replies View Related

Setcookie And Special Characters

Dec 18, 2001

I searched, but couldn't find anything, so I'm asking you guys.
I got some strange behavior from setcookie when special characters are involved in a string.

when you want to write a username posted via form into a cookie and the user types this:
[input] It's [/input]
and you read the data out of the cookie it comes out like this:
[input] It's [/input]

A call to stripslashes() won't remove those backslashes, any ideas?

View 3 Replies View Related

Special Characters () And Zipfiles

Jul 17, 2005

I've been searching google about this for days but can't find anything,
so I'm hoping someone here can help me out.

I'm trying to create zip-files without needing the zip-file extension in
PHP, mainly because I need the ability to both create and extract
zip-files. I've tried a couple of classes found here and there, and they
all seem to have the same problem. I'm currently using PclZip
( but even the simplest one I've tried
(zip.lib.php from phpMyAdmin) gives the same result.

This is the problem:

When I create a zip-file containing any file with special characters in
their filenames, the characters gets translated into different special
characters. The three characters I myself am having problems with is the
Norwegian , and (uppercase , and ), all of which are very
common in my language. The zip-file itself can contain these characters
without any problems, the only files affected are the ones put into the
zip-file. Same happens with directories, obviously. The funny thing is,
if I extract a zip-file using the same class, the conversion gets
reversed, so the files do end up with the correct names after
extraction. This of course means that if I upload a zip-file created
using WinZip or any other zip-application, any files with special
characters will get translated into completely different characters again.

I've made a table showing the converted characters which can be found

Also very strange - I tried making a zip-file containing a zero-length
file with the special characters in the filename, and when opening that
zip-file in a hex-editor I wasn't able to find the hex values for the
converted characters anywhere in the file, but the original filename
characters were found at the places where I expected them to be.

If someone can help me figure out what's going on I would really
appreciate it. I've submitted it as a bug for PclZip but it hasn't
gotten any response yet, and since I've seen the same thing happen with
other classes I sort of doubt it's only related to PclZip. I've tried it
on different servers as well, and with the same result. I've got the
impression that PclZip is a popular class for managing zip-files,

View 7 Replies View Related

Special Characters (apostrophes, Etc.)

Sep 3, 2000

I tried the escaping code in a variety of ways in my script and still no luck. My server is running PHP3 and MySQL 3.22. The only fields where apostrophes will need to be dealt with are the 'name' and 'location1' thru 'location3'. Here is the code from the form generating PHP script for modifying the database: Code:

View 1 Replies View Related

How To Handle Special Characters Like , Etc In Php

May 4, 2001

I am passing company name entered by the user on our site to a system command. But whenever a user enter's some special char like or then the command fails. I want to know how to handle these character's while passing them to a system command. I am using Exec() of php. any help is appreciated.

View 6 Replies View Related

Parsing Special Characters

Jul 21, 2006

There are so many functions that parse form submissions (is parse the right word?) ...


... but I want to make sure I cover all my bases. Rather than spend the time trying every combination of these... can someone write out the best way to parse the following...

$str = "Testing MySite ™ — ‘Site Test’ for Jabbamonkeys Site. He says, “Thanks for the help.” And I say„ Uh-huh. What the special characters, like: Ã Ä Å. Click here <a href=""></a> to visit."

and make it into...

$str = "Testing MySite &trade; &mdash; &lsquo;Site Test&rsquo; for Jabbamonkeys Site. He says, &ldquo;Thanks for the help.&rdquo; And I say&bdquo; Uh-huh. What the special characters, like: &Atilde; &Auml; &Aring;. Click here <a href=""></a> to visit."

I want it to keep the html formatting (such as the href tag), but change all the special characters. Can someone show me a custom function that does this, or one that already exists?

View 2 Replies View Related

Special Characters Are Turned Into '?'

Sep 10, 2005

I have this script that passes a variable to Google in order to perform a search. The content of the variable comes form an input field in a form:

<form name="form" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>" method="get">
<input type="text" name="q" value=" Search">
<input name="Submit" type="submit" value=" Search ">

The variables and the code snippet look like this: .....

View 6 Replies View Related

$_GET With Special Characters

May 9, 2006

I have a username, ie., stored in a database. It goes in fine, and displays properly. It appears correct in the database.

However, when I try to display it in a textfield for editing from a $_GET, it comes out something like:


Any ideas what could be causing this? So far, I have tried htmlspecialchars and addslashes, but they aren't helping.

$str = $_GET['email'];
echo $str;

View 2 Replies View Related

Preg_replace Special Characters

May 12, 2006

how I can replace just a couple special characters from the string. We have a client that has product names that include ® and ™ symbols in the title. And when I create a mailto: link w/ the product name in the ?subject=, it shows some strange characters around those two symbols. So how can I strip out those two specific characters from the string? I tried this, but it doesn't work. Code:

str_replace('®|™', '', $prd['prd_titl']).

View 3 Replies View Related