Another File Upload Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • silveira neto

    Another File Upload Problem

    I got a php script that makes a upload to my server. But it actualy don't works. I'm working on Kurumin Linux 2.13, Apache 1.3.26 and PHP4.
    The source (it handles an string gotten in a form):

    if ($file == "none") { echo"Try put an valid file.";
    echo"<a href=index.html >back</a>";
    }else {
    copy($file, "myfile/".$file_nam e);
    unlink($file);
    echo"All Right!";
    }

    The erro:
    Warning: Unable to create 'arquivos/exemple.txt': Permission denied in /var/www/up/upload.php on line 25

    Ok, its a problem with permision, right?
    But, how can I resolve this? How can I give permision to PHP write in my HD? Is it secure?
    Thanks!


  • Stefan Mehnert

    #2
    Re: Another File Upload Problem

    [color=blue]
    > Ok, its a problem with permision, right?
    > But, how can I resolve this? How can I give permision to PHP write in my HD? Is it secure?[/color]

    CHMOD ist the Linux Command to change Permissions. Php has also a chmod
    function.

    Try this:

    -> chmod("/somedir/somefile", 0755); // octal; correct value of mode


    Greets,
    Stefan Mehnert

    Comment

    • Agelmar

      #3
      Re: Another File Upload Problem

      "silveira neto" <otenarievlis@y ahoo.com.br> wrote in message
      news:0bb4d2fa79 69fbb833b42e0a9 6eb1363@localho st.talkaboutpro gramming.com...[color=blue]
      > I got a php script that makes a upload to my server. But it actualy don't[/color]
      works. I'm working on Kurumin Linux 2.13, Apache 1.3.26 and PHP4.[color=blue]
      > The source (it handles an string gotten in a form):
      >
      > if ($file == "none") { echo"Try put an valid file.";
      > echo"<a href=index.html >back</a>";
      > }else {
      > copy($file, "myfile/".$file_nam e);
      > unlink($file);
      > echo"All Right!";
      > }
      >
      > The erro:
      > Warning: Unable to create 'arquivos/exemple.txt': Permission denied in[/color]
      /var/www/up/upload.php on line 25[color=blue]
      >
      > Ok, its a problem with permision, right?
      > But, how can I resolve this? How can I give permision to PHP write in my[/color]
      HD? Is it secure?[color=blue]
      > Thanks![/color]

      I'm suprised it even gets that far. You are relying on register_global s =
      On, you should use $_FILES instead...


      Comment

      Working...