You are here: Re: Uploading files with an apostrophe in the filename « All PHP « IT news, forums, messages
Re: Uploading files with an apostrophe in the filename

Posted by Mark Goodge on 05/14/07 19:07

On Mon, 14 May 2007 00:25:58 +0200, Alfred Molon put finger to
keyboard and typed:

>In article <1179093340.453709.241100@n59g2000hsh.googlegroups.com>,
>matt.farey@gmail.com says...
>
>> alfred, i use php uploads with single quotes just fine, it copes with
>> a large range of characters including single quotes.
>> you say "the uploads dont work properly" but I am unclear as to what
>> that means, where does the process fail? I just think it's a coding/
>> config issue, the actual upload functionality will remain completely
>> unaffected - if your system is set up properly.
>
>It's a shared host and I can not set the system.
>
>In any case what happens, is that the image will upload and be stored in
>the temporary , but then the PHP code will mess up the filename.
>
>For instance, if I upload the file "Al Azhar's mosque Cairo.jpg" (with
>the apostrophe), the PHP code will automatically convert the filename to
>"Al Azhar\'s mosque Cairo.jpg" (i.e. insert a backslash) and store a
>file named "Al Azhar\'s mosque Cairo.jpg" in the temporary directory.

You've got magic_quotes_gpc switched on, but the script assumes you
haven't. That's one of the gotchas I was referring to in a different
thread!

There are two solutions to that. The easiest, if you can do it, is to
switch it off either sitewide (using .htaccess) or in the upload
script (using php_ini_set()). If you can't, then you need to pass the
variables through stripslashes() before processing them with your file
handling routine.

Mark
--
Please give me one! http://www.pleasegivemeone.com
"L'amore giunger, l'amore"

 

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

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