Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,376
    Thanks
    263
    Thanked 32 Times in 31 Posts

    file case rename issue

    i was going to post this in apache forum here but when i clicked on the link it gave me a db error on your site.. so ill post it here...

    i understand by default that the servers normally are set to accept both uppercase and lowercase names as unique, and i have checked with my host and yes it does, however in my php file when i do a rename of a file it tells me the file already exists and i checked and there is no lowercase function used, so not sure why it will not accept the unique difference between uppercase and lowercase file names.. ..

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,293
    Thanks
    4
    Thanked 202 Times in 199 Posts
    Is your host a Windows or Linux machine? Windows does not differentiate between upper and lower case but Linux does.
    Dave .... HostMonster for all of your hosting needs

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,376
    Thanks
    263
    Thanked 32 Times in 31 Posts
    its a linux, its got me puzzled lol

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Your question is pretty ambiguous. You need to post some code or something that can be reproduced.

  • #5
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,376
    Thanks
    263
    Thanked 32 Times in 31 Posts
    ok here is where i pull them from the db and the post values

    Code:
                $filename = strip_tags($db->f('filename'));
                $filepath = strip_tags($db->f('filepath'));
                $oldpath = $filepath;
                $oldname=$filename;
                 
                if (isset($_POST['newname'])) {
                    $newpath = mysql_escape_string($_POST['newpath']);
                    $newname = mysql_escape_string($_POST['newname']);
                    $longname = "$newpath$newname";
    and then i do a few if statements to make sure its the same filepath dir and the input is not null, then i update the db with the new info then i rename the file in the directory

    Code:
     rename ("$filepath$filename", "$newpath$newname");

    but even if the $oldname is lowercase and the $newname is uppercase it tells me the file already exists.

  • #6
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,376
    Thanks
    263
    Thanked 32 Times in 31 Posts
    i may have found it, when i do the compare one file name to new file name, im checking the db values not the input values, so naturally it will be the same..



    if im correct i need to compare the input data, that way it can be unique uppercase or lowercase on the compare...


    but im not sure how to write uppercase name to the db value.. or is that a given ( i mean will it write the value as is, however its input upper or lower) ill have to test that..

  • #7
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    The database doesn't give a monkeys what case you supply. It inserts it as is. You ought to be prepending a unique identifier to each file, to limit the probability of two filenames ever matching. Use the current timestamp, a randomly generated string etc.


  •  

    Tags for this Thread

    Posting Permissions

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