You are here: Re: [PHP] rename an uploaded file. « PHP « IT news, forums, messages
Re: [PHP] rename an uploaded file.

Posted by "Richard Lynch" on 08/11/05 00:18

On Tue, August 9, 2005 6:16 am, Stut wrote:

> Colons (:) are not allowed in Windows filenames.

Of course they aren't allowed in file NAMES -- Because they are an
integral part of a drive letter designation such as "C:" which is what is
being used here.

There's nothing wrong with the C: part of the filenames.

>> $old = 'C:\\homedirectory\uploadedfiles\\newfile.gif';
>
> Also, you don't need to escape the backslashes when using single quotes.

But you should.

' and \ are both special character sequences inside of ''

$string = 'Don\'t you know \\ is not the same as /?';

\h (or anything other than ' or \ behind \) will "work" but is not Good
Programming, imho.

You can also, in some versions, "get away" with having \ inside of "" so
long as the following character isn't special:
$string = "C:\homedirectory\uploadedfiles\\newfile.gif";

Note that the 'n' character is special (newline) but 'h' and 'u' are not
(I don't think) so this "should work"

That doesn't make it Good Practice.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация