Menu

#17 File Name Problem with PHP 4.3.10

open
nobody
None
5
2005-01-26
2005-01-26
No

Our servers just got upgrade to PHP 4.3.10, of course
without telling me and its causing a minor problem with
Megaupload, instead of getting just the ifile name is
giving the whole file location, C:\Documents and
Settings\All Users\Documents\My Pictures\Sample
Pictures\Winter.jpg, so that's the file name now, I'm
just starting to look into the code and see what's
happening.

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Looks like progress.php is the problem. I went back to
    progress.cgi and file names are handled correctly.

     
  • Scott Norman

    Scott Norman - 2005-01-27

    Logged In: YES
    user_id=958188

    Looks like problem lies with progress.php. I went back to
    progress.cgi. and it works.

     
  • Scott Norman

    Scott Norman - 2005-02-11

    Logged In: YES
    user_id=958188

    IE 6.0 files become named C:\\directory\\...\\filename, so I
    did a fix in upload2.php. Looked at the Perl, but not an
    expert there and wanted to get this fixed. This is happening
    on a *nix servers, not sure if same problem on Windows
    servers and not sure about earlier versions of IE, don't
    have earlier versions of IE. Put this code before file and
    file size get printed and also change the two lines that
    have been commented:

    // IE 6.0 File Name Fix
    // IE 6.0 File Names get upload as
    C:\\directory\\...\\filename, so get
    //get the actual file name and not file name and directory
    // Scott Norman, scott@yourhost.com
    if (strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 6.0")){
    $TempFileName = explode("\\",$file['name'][$i]);
    $FileName = $TempFileName[count($TempFileName)-1];
    }
    else {
    $FileName = $file['name'][$i];
    }

     
  • Scott Norman

    Scott Norman - 2005-02-11

    Logged In: YES
    user_id=958188

    Missed part of the code in last message, here's all the code:

    IE 6.0 files become named C:\\directory\\...\\filename, so I
    did a fix in upload2.php. Believe this error cropped up in
    PHP 4.3.10, but not sure. I looked at the Perl, but not an
    expert there and wanted to get this fixed. This is happening
    on a *nix servers, not sure if same problem on Windows
    servers and not sure about earlier versions of IE, don't
    have earlier versions of IE. Put this code before file and
    file size get printed and also change the two lines that
    have been commented:

    // IE 6.0 File Name Fix
    // IE 6.0 File Names get upload as
    C:\\directory\\...\\filename, so get
    //get the actual file name and not file name and directory
    // Scott Norman, scott@yourhost.com
    if (strpos($_SERVER["HTTP_USER_AGENT"],"MSIE 6.0")){
    $TempFileName = explode("\\",$file['name'][$i]);
    $FileName = $TempFileName[count($TempFileName)-1];
    }
    else {
    $FileName = $file['name'][$i];
    }

    echo '<td align="left">' . $FileName . "</td>\n";
    //echo '<td align="left">' . $file['name'][$i] ."</td>\n";
    echo '<td align="right">' . $file['size'][$i] ."</td></tr>\n";

    rename($file['tmp_name'][$i],
    '/usr/sites/yourhost.com/www/megaupload/'. $FileName);

    //rename($file['tmp_name'][$i],
    '/usr/sites/yourhost.com/www/megaupload/'. $file['name'][$i]);

     
  • Nobody/Anonymous

    Logged In: NO

    thank you mokele, that fixed my problem.

     

Log in to post a comment.