File?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • r.knipscheer@home.nl

    File?

    Hi,

    i've written a function to check if an image on a server exists:
    i send the url to check to the function and check it with:

    $file = @file ($url);
    if ($file) {

    this works ok, as long as i use it on my computer. As soon as i upload
    it to my webserver this function won't work. Is this a known security
    issue?

    Thank you.

    Rotsj

  • Rik

    #2
    Re: File?

    r.knipscheer@ho me.nl wrote:[color=blue]
    > Hi,
    >
    > i've written a function to check if an image on a server exists:
    > i send the url to check to the function and check it with:
    >
    > $file = @file ($url);
    > if ($file) {
    >
    > this works ok, as long as i use it on my computer. As soon as i upload
    > it to my webserver this function won't work. Is this a known security
    > issue?[/color]

    Is a security issue:

    www.php.net:
    Tip: You can use a URL as a filename with this function if the fopen
    wrappers have been enabled. See fopen() for more details on how to specify
    the filename and Appendix M for a list of supported URL protocols.

    phpinfo()
    check allow_url_fopen

    Grtz,
    --
    Rik Wasmus


    Comment

    • Erwin Moller

      #3
      Re: File?

      r.knipscheer@ho me.nl wrote:
      [color=blue]
      > Hi,
      >
      > i've written a function to check if an image on a server exists:
      > i send the url to check to the function and check it with:
      >
      > $file = @file ($url);
      > if ($file) {
      >
      > this works ok, as long as i use it on my computer. As soon as i upload
      > it to my webserver this function won't work. Is this a known security
      > issue?
      >
      > Thank you.
      >
      > Rotsj[/color]

      Did you read php.net on the subject?



      (or just go to www.php.net, and type file into the searchbox)

      It contains a warning about using url-wrappers.
      Maybe that is the problem.

      And also: File() is ment to retrieve an array with lines, not very fitting
      for an image IMHO.
      So file() isn't the right function to take in an imagefile (allthough it
      might work allright).

      Regards,
      Erwin Moller

      Comment

      Working...