Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Problem Reading File when Name contains "?"
Here are suggestions that I have received from various sources and am
trying myself (to the extent that I know what he's talking about):

1. ? is a special symbol that shouldn't be used within a file name.
As for other symbols - 164 might require you to set a proper non-
unicode symbol table, and other symbols are just garbage, as far as i
see the ASCII table.

2. I think this is a trouble that has to do with the file system you
are using, some file systems requires prepending "\\?\" to the file
name to be able to get around it's normal file name checks.

3. If your code is working for normal files, odds are good that you
need to escape these special characters before you can read them.
Escaping these is dependent on your operating system, so the character
you'll use depends on the system you're running. If your system uses
the backslash to escape characters (ie, Linux), try writing these
characters with a leading backspace, ie:
foreach(glob("$dir/*") as $eachFile) {
$eachFile = preg_replace('/['.chr(63).chr(164).chr(186).']/', '\\\
\\\0', $eachFile);
print "$eachFile : ".strlen(file_get_contents($eachFile))."\n"; }

4. Question mark is illegal in file names on both Windows and Unix...
It is illegal on Windows, but it is quite valid in Unix. Forward
slash / is the only character that is invalid in a Unix file name.
Try replacing "?" with "%3F"

5. Try this one, just to explore some.  echo(basename
($PHP_SELF)."<br>"); // returnes filename.php

6. You will need to construct a routine to preface the file read or to
actually dig into the PHP library and modify the base module for that
read.

7. Could we copy the original file to a standard name, or rename it,
without causing an error? I will look and see what ways the different
functions have of handling filenames and
pathing...

Report this thread to moderator Post Follow-up to this message
Old Post
PHPBABY3
03-23-08 01:04 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:02 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.