I have problems with files uploaded with Greek names {μανος.jpg} Ξ ΞΞΤΠ¥ Ξ uploaded Why JPG in my directory uploaded? I do not use my SSL, another image uploaded success by its name.
My code is:
& lt ;! DOCTYPE html public "- //W3C / DTD XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" dir = "ltr" & gt; & Lt; Major profile = "http://gmpg.org/xfn/11" & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt ;? Php $ uploaddir = './uploads/'; $ File = $ Upload Dard basename ($ _ files ['uploadfile'] ['name']); If (move_uploaded_file ($ _ files ['uploadfile'] ['tmp_name'], $ file)) {"echo"; } And {echo "error"; }? & Gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; / Body & gt; thanks
It seems that the underlying file system is' Unicode Do not deal with file names, or getting the wrong data from the browser.
Ensure that the form with which you send the file is also UTF-8 encoded.
If that does not help:
-
The most common way to go about this is to give the file a new, computer-generated name (such as a number , Or user ID and serial number, or a random string). It will be the easiest way -
If it is not an option, then before filing it, click the urlencode () . This will create a file name that is guaranteed to work on the file system. Whenever the file name is output, use urldecode () to display it - if it is not a browser that is wrong, then it should show proper Greek characters. If that does not work, then the browser client is sending the name of the file in the encoding of the operating system (eg UTF-16 in Windows / NTFS) in that case, you need to either start Go with that (which is very unreliable) or with Option 1
Comments
Post a Comment