Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 5 of 5

Thread: Problem deleting file

  1. #1

    Problem deleting file

    Hey guys.. long time no see (vacation was fun ) anyway...

    I'm writing a file to update a thumbnail in a database.
    The problem i am having is that the script will not delete (unlink) the old thumbnail image.

    I keep getting this error:
    An error occurred in script '/home1/birdwing/public_html/admin/portfolio/upload.php' on line 117: unlink() [<a href='function.unlink'>function.unlink</a>]: http does not allow unlinking
    I know, I know.. the permissions aren't set properly.. HOWEVER my script is supposed to set the permissions of first the directory, and THEN the file to 777. Then delete the file and reset the directories permission to 755.

    here is the code:
    PHP Code:
    // delete old entry
    $t: is the name of the file
    and $a_id: is the directory it's in (a number)

    the first line outputs: ../../images/portfolio/1/
    the second line outputs: ../../images/portfolio/1/thumb_2.gif
    the last line outputs: ../../images/portfolio/1/

    so i know my variables are correct...

    what could be the problem?
    Last edited by birdwing; July 24th, 2009 at 06:06 PM.

    Twitter / The Human Conditions

    biznuge: "that doesn't grammatical sense..."

  2. #2
    the script cannot change the chmod if it doesn't have the right permissions (chmod) to it... this needs to be done by the owner... php scripts are executed with the www-data system account...

    verify with ftp or ssh that the chmod actually happens...

    if it doesn't, manually chmod the parent folder, and test the scripts again.

    if you want the script to handle the chmod in the future, make sure the parent folder of the targetted chmod locations have the correct chmod.

    (i hope that made any sense...)

    You can never underestimate the stupidity of the general public.

  3. #3
    I removed the code from my file that switches the permissions back and checked it.
    Both the folder and the file are now 777 so the chmod is successfully being changed...

    could it be the directory before the one i'm changing? it would be a PIA if i had to change the permissions of all the directories leading up to the one the file is in before i have to delete it.

    Twitter / The Human Conditions

    biznuge: "that doesn't grammatical sense..."

  4. #4
    *slaps self in forehead*

    duh.... you can't unlink using a direct URL.. >.<

    oooops... ha.. ha..

    *has lost 1 interwebz*

    Ok now that im no longer an idiot....thanks for the help RvGaTe
    Last edited by birdwing; July 24th, 2009 at 07:10 PM.

    Twitter / The Human Conditions

    biznuge: "that doesn't grammatical sense..."

  5. #5
    OMG.... i didn't see that either... haha


    You cant unlink a full http path.... xD
    Last edited by RvGaTe; July 24th, 2009 at 10:36 PM. Reason: unluck? wtf... typo

    You can never underestimate the stupidity of the general public.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012