Results 1 to 2 of 2

Thread: Checking list

  1. #1
    Join Date
    Jan 2008
    Posts
    42
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Checking list

    I have this list that is being passed to a PHP page from a java program, the list looks like this:

    Code:
    file1.jpg,file2.jpg,file3.jpg,etc
    What I want to do is go through that list and find files in the list that have illegal characters in their names, like spaces and others, and rename the files after being changed to characters to something like "_". Could I have some help on this please? I kind of figure it would have to be converted into an array, then sorted or something of the sort.

    Thanks in advance.

  2. #2
    Join Date
    Jan 2008
    Posts
    42
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default

    Ok all done here is my code for that:

    PHP Code:
    if(ftp_chdir($conn$www.$images)) {

    $export str_replace($_REQUEST['baseDir']."\\\\"""$_REQUEST['f']);

    $list explode("#,#"$export);

    for(
    $i 0$i sizeof($list) - 1$i++)
    {
    $extension ".".substr(strrchr($list[$i], '.'), 1);
    $fileName RemoveExtension($list[$i]);
    ftp_rename($conn$list[$i], filename_safe($fileName).$extension);

    This gets the list, explodes it replaces all characters and basedir originally in list and then renames file on server without the bad extensions.

    Thanks for everyones help.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •