php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14898 $HTTP_POST_FILES['uploadedfile']['name'] error
Submitted: 2002-01-07 01:56 UTC Modified: 2005-09-02 07:37 UTC
From: a1593 at ma dot ks dot edu dot tw Assigned:
Status: Closed Package: HTTP related
PHP Version: 4.0.0 OS: ANY
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: a1593 at ma dot ks dot edu dot tw
New email:
PHP Version: OS:

 

 [2002-01-07 01:56 UTC] a1593 at ma dot ks dot edu dot tw
/*
This is a bug fix for rfc1867.c
try to upload file from win2k with name C:\DISK0\?\?\.txt
the original code get name as '.ext' which should be '?\?\.txt'. 
the following modify is necessary to for client using charset=BIG5.
thanks PHP.
lai a1593@ma.ks.edu.tw
*/
-----------code modified----------------------
//s = strrchr(filenamebuf, '\\');
for (s=filenamebuf+strlen(filenamebuf)-1;s>filenamebuf;s--) {
 if (*s=='\\' && *(s-1)>0) break;
}
----------code modified end ------------------- 
 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-07 22:48 UTC] a1593 at ma dot ks dot edu dot tw
the fix is too rough and can't handle all chinese words, it need more efforts to check. i will do it in a few days.
 [2002-01-08 09:37 UTC] a1593 at ma dot ks dot edu dot tw
the following code works well for chinese double-byte checking.
-----------code modified----------------------
//s = strrchr(filenamebuf, '\\');
char *tmps;
for (tmps=filenamebuf;*tmps;tmps++) {
  if (*tmps<0){// *tmps>127, looks like 2 bytes of chinese code
    if (!*(tmps+1)) tmps++;
    contonue;
  }
  if (*tmps=='\\') s=tmps;
}
----------code modified end ------------------- 

 [2002-01-09 03:42 UTC] a1593 at ma dot ks dot edu dot tw
-----------code modified----------------------
//s = strrchr(filenamebuf, '\\');
char *tmps;
s=filenamebuf; // set initial value 
for (tmps=filenamebuf;*tmps;tmps++) {
  if (*tmps<0){// *tmps>127, looks like 2 bytes of chinese code
    if (!*(tmps+1)) tmps++;
    continue;
  }
  if (*tmps=='\\') s=tmps;
}
----------code modified end -------------------
 [2002-01-11 06:24 UTC] a1593 at ma dot ks dot edu dot tw
anyway, i hope this is the final post about this issue.
----------------------------------------------
s = strrchr(filenamebuf, '\\');
tmps=filenamebuf;
while (!(*tmps==NULL)) {
  if (!(*tmps>0 && *tmps<160)) {//looks like a chinese word
    if (!*(tmps+1)==NULL) tmps++;
  } else {
    if (*tmps=='\\') s=tmps;
  }
  tmps++;
}
-----------------------------------------------
 [2002-02-07 22:52 UTC] shiflett@php.net
Is this a patch proposal? I don't see any bugs...
 [2002-02-08 10:36 UTC] a1593 at ma dot ks dot edu dot tw
it is better to say that this is an improvement to make the upload function can treat mulit-byte codes like BIG5. there is a explanation in my first post.  
 [2002-04-03 02:45 UTC] yohgaki@php.net
It's known issue that PHP does not work well with multi-byte file names. 
This is better to be fixed someday. We don't know encoding used for filename, but it should be useful still.


 [2005-09-02 07:37 UTC] sniper@php.net
Some kind of support exists nowadays. (if it doesn't, it will in PHP 6)

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Mar 14 23:01:29 2025 UTC