dcsimg
Results 1 to 2 of 2

Thread: Warning function unlink is a directory

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2016
    Posts
    2

    Warning function unlink is a directory

    hi all

    i am using this code line to delete image from folder

    PHP Code:
    unlink("../graphics/".$image); 
    it works fine on my localhost.

    But on my live hosting server i m getting this error

    PHP Code:
    Warningunlink(../graphics/) [function.unlink]: Is a directory in 

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,907

    Re: Warning function unlink is a directory

    The variable $image must be blank and the unlink function is trying to delete the directory rather than the image. Does $image come from an input variable from a form / URL query string?

    If this is the case, register_globals is switched off on the hosting server (its best practice and shouldn't be enabled as it makes things rather insecure). You can get at the variable using the $_GET or $_POST super global, e.g. $_GET['image'].

    Finally if you are using the variable direct from an input form, ensure you validate it for characters which should not be there, including preceding periods, forward slashes and back slashes. Otherwise, a malicious user could use a string like "../../../../../../../../../etc/php.ini" and cause havoc on the server or inside your hosting directory.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width