move_uploaded_file isn't working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stijn Goris

    move_uploaded_file isn't working

    HI all,

    I have created a script that allows a user to upload a picture. I have an
    IIS server runing on my own pc but the actual site runs an Apache server.
    The upload script worked perfectly on my IIS but refuses to work on the
    Apache.

    All I know is that the script stops working at move_uploaded_f ile()
    function. The warnings echo'ed are:
    Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to open
    stream: Permission denied in
    /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
    line 108

    Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
    'images/nieuws/TIDEEY%7E1.jpg' in
    /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
    line 108

    I also echo the $_FILES['imageFile']['error'] which returns a 0 (no error at
    all). I first do a is_uploaded_fil e() which returns no errors at all. The
    nieuws dir has 766 rules applied.

    Maybee someone can help me out?

    Thanks
    Stijn


  • Michael Austin

    #2
    Re: move_uploaded_f ile isn't working

    Stijn Goris wrote:
    [color=blue]
    > HI all,
    >
    > I have created a script that allows a user to upload a picture. I have an
    > IIS server runing on my own pc but the actual site runs an Apache server.
    > The upload script worked perfectly on my IIS but refuses to work on the
    > Apache.
    >
    > All I know is that the script stops working at move_uploaded_f ile()
    > function. The warnings echo'ed are:
    > Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to open
    > stream: Permission denied in
    > /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
    > line 108
    >
    > Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
    > 'images/nieuws/TIDEEY%7E1.jpg' in
    > /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
    > line 108
    >
    > I also echo the $_FILES['imageFile']['error'] which returns a 0 (no error at
    > all). I first do a is_uploaded_fil e() which returns no errors at all. The
    > nieuws dir has 766 rules applied.
    >
    > Maybee someone can help me out?
    >
    > Thanks
    > Stijn
    >
    >[/color]

    the user that owns the Apache server does not have permissions to write into the
    directory.

    --
    Michael Austin.
    Consultant - Available.
    Donations welcomed. Http://www.firstdbasource.com/donations.html
    :)

    Comment

    • Ken

      #3
      Re: move_uploaded_f ile isn't working

      Ask your users the correct syntax for the directory to upload files.

      Also the directory you have to create on the Apache server must have
      permission. Change permission to 777.

      Ken

      "Michael Austin" <maustin@firstd basource.com> wrote in message
      news:uEWRc.4449 $Xx6.3881@newss vr23.news.prodi gy.com...[color=blue]
      > Stijn Goris wrote:
      >[color=green]
      > > HI all,
      > >
      > > I have created a script that allows a user to upload a picture. I have[/color][/color]
      an[color=blue][color=green]
      > > IIS server runing on my own pc but the actual site runs an Apache[/color][/color]
      server.[color=blue][color=green]
      > > The upload script worked perfectly on my IIS but refuses to work on the
      > > Apache.
      > >
      > > All I know is that the script stops working at move_uploaded_f ile()
      > > function. The warnings echo'ed are:
      > > Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to[/color][/color]
      open[color=blue][color=green]
      > > stream: Permission denied in
      > > /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
      > > line 108
      > >
      > > Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
      > > 'images/nieuws/TIDEEY%7E1.jpg' in
      > > /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
      > > line 108
      > >
      > > I also echo the $_FILES['imageFile']['error'] which returns a 0 (no[/color][/color]
      error at[color=blue][color=green]
      > > all). I first do a is_uploaded_fil e() which returns no errors at all.[/color][/color]
      The[color=blue][color=green]
      > > nieuws dir has 766 rules applied.
      > >
      > > Maybee someone can help me out?
      > >
      > > Thanks
      > > Stijn
      > >
      > >[/color]
      >
      > the user that owns the Apache server does not have permissions to write[/color]
      into the[color=blue]
      > directory.
      >
      > --
      > Michael Austin.
      > Consultant - Available.
      > Donations welcomed. Http://www.firstdbasource.com/donations.html
      > :)[/color]


      Comment

      • Stijn Goris

        #4
        Re: move_uploaded_f ile isn't working


        "Ken" <kkrolski@wi.rr .com> wrote in message
        news:o7_Rc.2791 8$ju6.10565@twi ster.rdc-kc.rr.com...[color=blue]
        > Ask your users the correct syntax for the directory to upload files.
        >
        > Also the directory you have to create on the Apache server must have
        > permission. Change permission to 777.
        >
        > Ken
        >
        > "Michael Austin" <maustin@firstd basource.com> wrote in message
        > news:uEWRc.4449 $Xx6.3881@newss vr23.news.prodi gy.com...[color=green]
        > > Stijn Goris wrote:
        > >[color=darkred]
        > > > HI all,
        > > >
        > > > I have created a script that allows a user to upload a picture. I have[/color][/color]
        > an[color=green][color=darkred]
        > > > IIS server runing on my own pc but the actual site runs an Apache[/color][/color]
        > server.[color=green][color=darkred]
        > > > The upload script worked perfectly on my IIS but refuses to work on[/color][/color][/color]
        the[color=blue][color=green][color=darkred]
        > > > Apache.
        > > >
        > > > All I know is that the script stops working at move_uploaded_f ile()
        > > > function. The warnings echo'ed are:
        > > > Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to[/color][/color]
        > open[color=green][color=darkred]
        > > > stream: Permission denied in
        > > > /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php[/color][/color][/color]
        on[color=blue][color=green][color=darkred]
        > > > line 108
        > > >
        > > > Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
        > > > 'images/nieuws/TIDEEY%7E1.jpg' in
        > > > /scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php[/color][/color][/color]
        on[color=blue][color=green][color=darkred]
        > > > line 108
        > > >
        > > > I also echo the $_FILES['imageFile']['error'] which returns a 0 (no[/color][/color]
        > error at[color=green][color=darkred]
        > > > all). I first do a is_uploaded_fil e() which returns no errors at all.[/color][/color]
        > The[color=green][color=darkred]
        > > > nieuws dir has 766 rules applied.
        > > >
        > > > Maybee someone can help me out?
        > > >
        > > > Thanks
        > > > Stijn
        > > >
        > > >[/color]
        > >
        > > the user that owns the Apache server does not have permissions to write[/color]
        > into the[color=green]
        > > directory.
        > >
        > > --
        > > Michael Austin.
        > > Consultant - Available.
        > > Donations welcomed. Http://www.firstdbasource.com/donations.html
        > > :)[/color]
        >
        >[/color]

        problem solved, thanks.

        Why do I need 777. Is write and read acces not enough?

        regards


        Comment

        • Alvaro G Vicario

          #5
          Re: move_uploaded_f ile isn't working

          *** Stijn Goris wrote/escribió (Tue, 10 Aug 2004 10:05:45 +0200):[color=blue]
          > Why do I need 777. Is write and read acces not enough?[/color]

          Without access permission you can read and write files--you just can't get
          directory listings.


          --
          --
          -- Álvaro G. Vicario - Burgos, Spain
          --

          Comment

          • Justin Koivisto

            #6
            Re: move_uploaded_f ile isn't working

            Stijn Goris wrote:
            [color=blue]
            > "Ken" <kkrolski@wi.rr .com> wrote in message
            > news:o7_Rc.2791 8$ju6.10565@twi ster.rdc-kc.rr.com...
            >[color=green]
            >>Ask your users the correct syntax for the directory to upload files.
            >>
            >>Also the directory you have to create on the Apache server must have
            >>permission. Change permission to 777.
            >>
            >>Ken
            >>
            >>"Michael Austin" <maustin@firstd basource.com> wrote in message
            >>news:uEWRc.44 49$Xx6.3881@new ssvr23.news.pro digy.com...
            >>[color=darkred]
            >>>Stijn Goris wrote:
            >>>
            >>>
            >>>>HI all,
            >>>>
            >>>>I have created a script that allows a user to upload a picture. I have[/color]
            >>
            >>an
            >>[color=darkred]
            >>>>IIS server runing on my own pc but the actual site runs an Apache[/color]
            >>
            >>server.
            >>[color=darkred]
            >>>>The upload script worked perfectly on my IIS but refuses to work on[/color][/color]
            >
            > the
            >[color=green][color=darkred]
            >>>>Apache.
            >>>>
            >>>>All I know is that the script stops working at move_uploaded_f ile()
            >>>>function. The warnings echo'ed are:
            >>>>Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to[/color]
            >>
            >>open
            >>[color=darkred]
            >>>>stream: Permission denied in
            >>>>/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php[/color][/color]
            >
            > on
            >[color=green][color=darkred]
            >>>>line 108
            >>>>
            >>>>Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
            >>>>'images/nieuws/TIDEEY%7E1.jpg' in
            >>>>/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php[/color][/color]
            >
            > on
            >[color=green][color=darkred]
            >>>>line 108
            >>>>
            >>>>I also echo the $_FILES['imageFile']['error'] which returns a 0 (no[/color]
            >>
            >>error at
            >>[color=darkred]
            >>>>all). I first do a is_uploaded_fil e() which returns no errors at all.[/color]
            >>
            >>The
            >>[color=darkred]
            >>>>nieuws dir has 766 rules applied.
            >>>>
            >>>>Maybee someone can help me out?
            >>>>
            >>>>Thanks
            >>>>Stijn
            >>>>
            >>>>
            >>>
            >>>the user that owns the Apache server does not have permissions to write[/color]
            >>
            >>into the
            >>[color=darkred]
            >>>directory.
            >>>
            >>>--
            >>>Michael Austin.
            >>>Consultant - Available.
            >>>Donations welcomed. Http://www.firstdbasource.com/donations.html
            >>>:)[/color]
            >>
            >>[/color]
            >
            > problem solved, thanks.
            >
            > Why do I need 777. Is write and read acces not enough?[/color]

            Yes, and no. The directory needs to be executable or you can't cd to it
            (needed to write into it). However, the files themselves only need
            write+read. Therefore, if you have existing files:

            chmod 777 dirname
            chmod 666 dirname/*

            --
            Justin Koivisto - spam@koivi.com
            PHP POSTERS: Please use comp.lang.php for PHP related questions,
            alt.php* groups are not recommended.

            Comment

            • Gordon Burditt

              #7
              Re: move_uploaded_f ile isn't working

              >> Why do I need 777. Is write and read acces not enough?[color=blue]
              >
              >Without access permission you can read and write files--you just can't get
              >directory listings.[/color]

              Without search permission (what I prefer to call x permission as
              applied to directories), you may be able to read the directory
              (depends on read permission), but you cannot access any files under
              that directory. A mode 444 directory is pretty much useless (except
              to root), as all you can do is list the files you can't access.
              The same applies to a mode 666 directory (you can't create files,
              either). A mode 111 directory allows you to access the files and
              directories in it (subject to their permissions) *IF* you can guess
              their names.

              Permissions like 755 or 750 or 700 or 777 are more normal for
              directories. The octal digits 2, 3, 4, or 6 are fairly unusual in
              directory permissions, and in my experience, it's usually a mistake
              (although I'm not claiming there is absolutely NO use for these).

              Gordon L. Burditt

              Comment

              Working...