[PHP] failed to open stream: continued - 3 -

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

    #1

    [PHP] failed to open stream: continued - 3 -

    the reply doesn't work, I much post a new one , sorry !!!!!


    Hi ! Thank you for the reply
    ><?php
    >>
    >if( isset($_POST['upload']) )
    >{
    >$content_dir = 'upload/'; // folder that file will move into
    >>
    >$tmp_file = $_FILES['fichier']['tmp_name'];
    >>
    >>
    >// copy the file into the folder
    >$name_file = $_FILES['fichier']['name'];
    >
    Hi,
    >
    Never trust your own code. ;-)
    In case of problems: output what you are doing.
    >
    So add here:
    >
    echo "\$tmp_file=$tm p_file<hr>";
    $target = $content_dir . $name_file;
    echo "\$target=$targ et<hr>";
    >
    What output does that give?
    $tmp_file=C:\WI NNT\TEMP\php1C. tmp
    --------------------------------------------------------------------------------
    $target=upload/Guitarre.jpg

    --------------------------------------------------------------------------------

    that means all paths are correct

    Do you recognize the directories?
    I think the directories are ok.
    Is the targetdirectory writable by PHP?
    Target directory is read & write allowed (tested with cmd and explorer copy
    & propriety)
    but if it is writable by PHP, I do not know and I think the pb is from here
    !

    something wrong in my php.ini (version 5.2.1) that it can not writable by
    PHP
    do you have an idea ?


    =============== =============== =============== =============== =============
    Again the errors :

    Warning: move_uploaded_f ile(upload/Guitarre.jpg)
    [function.move-uploaded-file]: failed to open stream: Permission denied in
    C:\Inetpub\wwwr oot\simple.php on line 27

    Warning: move_uploaded_f ile() [function.move-uploaded-file]: Unable to move
    'C:\WINNT\TEMP\ php1C.tmp' to 'upload/Guitarre.jpg' in
    C:\Inetpub\wwwr oot\simple.php on line 27

    Impossible copy into the folder upload


  • BoneIdol

    #2
    Re: failed to open stream: continued - 3 -

    On 16 Nov, 09:06, "Andy2500" <do_not_use_t.. .@yahoo.comwrot e:
    the reply doesn't work, I much post a new one , sorry !!!!!
    >
    Hi ! Thank you for the reply
    >
    >
    >
    <?php
    >
    if( isset($_POST['upload']) )
    {
    $content_dir = 'upload/'; // folder that file will move into
    >
    $tmp_file = $_FILES['fichier']['tmp_name'];
    >
    // copy the file into the folder
    $name_file = $_FILES['fichier']['name'];
    >
    Hi,
    >
    Never trust your own code. ;-)
    In case of problems: output what you are doing.
    >
    So add here:
    >
    echo "\$tmp_file=$tm p_file<hr>";
    $target = $content_dir . $name_file;
    echo "\$target=$targ et<hr>";
    >
    What output does that give?
    >
    $tmp_file=C:\WI NNT\TEMP\php1C. tmp
    --------------------------------------------------------------------------------
    $target=upload/Guitarre.jpg
    >
    --------------------------------------------------------------------------------
    >
    that means all paths are correct
    >
    Do you recognize the directories?
    >
    I think the directories are ok.
    >
    Is the targetdirectory writable by PHP?
    >
    Target directory is read & write allowed (tested with cmd and explorer copy
    & propriety)
    but if it is writable by PHP, I do not know and I think the pb is from here
    !
    >
    something wrong in my php.ini (version 5.2.1) that it can not writable by
    PHP
    do you have an idea ?
    >
    =============== =============== =============== =============== =============
    Again the errors :
    >
    Warning: move_uploaded_f ile(upload/Guitarre.jpg)
    [function.move-uploaded-file]: failed to open stream: Permission denied in
    C:\Inetpub\wwwr oot\simple.php on line 27
    >
    Warning: move_uploaded_f ile() [function.move-uploaded-file]: Unable to move
    'C:\WINNT\TEMP\ php1C.tmp' to 'upload/Guitarre.jpg' in
    C:\Inetpub\wwwr oot\simple.php on line 27
    >
    Impossible copy into the folder upload
    You could always just go...

    echo $_FILES['fichier']['error'];

    Then check the error code on http://www.php.net/manual/en/feature...oad.errors.php

    I'd imagine that may shine some light on your problem.

    Comment

    • Erwin Moller

      #3
      Re: [PHP] failed to open stream: continued - 3 -



      I copied my response from the other thread.

      Why don't you download the high quality FREE thunderbird newsreader if
      your current software is crap?

      It it quite annoying (for you and for us) if you must start a new thread
      every time......

      Get it here:
      Thunderbird is a free email application that’s easy to set up and customize - and it’s loaded with great features!


      Anyway: Here is a copy from my response.





      Andy2500 wrote:
      the reply works again ! I hope !
      >
      Hi ! Thank you for the reply
      Hi,

      What do you mean?
      Is your newsreader broken?
      >
      >><?php
      >>>
      >>if( isset($_POST['upload']) )
      >>{
      >>$content_di r = 'upload/'; // folder that file will move into
      >>>
      >>$tmp_file = $_FILES['fichier']['tmp_name'];
      >>>
      >>>
      >>// copy the file into the folder
      >>$name_file = $_FILES['fichier']['name'];
      >Hi,
      >>
      >Never trust your own code. ;-)
      >In case of problems: output what you are doing.
      >>
      >So add here:
      >>
      >echo "\$tmp_file=$tm p_file<hr>";
      >$target = $content_dir . $name_file;
      >echo "\$target=$targ et<hr>";
      >>
      >What output does that give?
      >
      $tmp_file=C:\WI NNT\TEMP\php1C. tmp
      OK, that looks reasonable.
      >
      --------------------------------------------------------------------------------
      $target=upload/Guitarre.jpg
      Is THAT allright?
      I seriously doubt that.
      It is not a full path.

      I would expect here something like:
      C:\inetpub\wwwr oot\somedirecto ry\upload\Guita rre.jpg

      Fix your $content_dir variable, and see if it works.

      >
      >
      --------------------------------------------------------------------------------
      >
      that means all paths are correct
      I do not agree with that conclusion.
      >
      >
      >Do you recognize the directories?
      I think the directories are ok.
      >
      >Is the targetdirectory writable by PHP?
      Target directory is read & write allowed (tested with cmd and
      explorer copy
      & propriety)
      but if it is writable by PHP, I do not know and I think the pb is
      from here
      !
      Well, if you don't know that, find out!
      PHP runs on IIS as IUSR_<machinena me>

      Find that user, and make sure that user has write right on the
      uploaddirectory .

      >
      something wrong in my php.ini (version 5.2.1) that it can not writable by
      PHP
      do you have an idea ?
      No, nothing wrong with your php.ini, based on what I heard so far.
      Maybe there is, but I suggest you first fix the path to a full path and
      make sure IUSR can write there before diving into php.ini settings.

      Regards,
      Erwin Moller
      >
      >
      =============== =============== =============== =============== =============
      Again the errors :
      >
      Warning: move_uploaded_f ile(upload/Guitarre.jpg)
      [function.move-uploaded-file]: failed to open stream: Permission
      denied in
      C:\Inetpub\wwwr oot\simple.php on line 27
      >
      Warning: move_uploaded_f ile() [function.move-uploaded-file]: Unable
      to move
      'C:\WINNT\TEMP\ php1C.tmp' to 'upload/Guitarre.jpg' in
      C:\Inetpub\wwwr oot\simple.php on line 27
      >
      Impossible copy into the folder upload
      >
      >
      >

      Comment

      • Andy2500

        #4
        Re: failed to open stream: continued - 3 -


        "BoneIdol" <leons87@hotmai l.comwrote in message
        news:e96caa88-bd4d-42a8-a358-220b60793abe@e1 g2000hsh.google groups.com...
        >
        You could always just go...
        >
        echo $_FILES['fichier']['error'];
        >
        Then check the error code on

        >
        I'd imagine that may shine some light on your problem.

        Thank you very much for your help.

        You gave me an excellent methode to find out the problem.

        Thank again and have a good week-end


        Comment

        • Andy2500

          #5
          Re: [PHP] failed to open stream: continued - 3 -


          "Erwin Moller"
          <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrote in
          message news:473db017$0 $229$e4fe514c@n ews.xs4all.nl.. .
          >
          >
          Well, if you don't know that, find out!
          PHP runs on IIS as IUSR_<machinena me>
          >
          Find that user, and make sure that user has write right on the
          uploaddirectory .
          >
          >
          I found it ! youpi !!!! ( the write right on directory in IIS )
          thank to your big help.

          Thank you very very very much
          and wish you an excellent week-end.


          Comment

          • Erwin Moller

            #6
            Re: [PHP] failed to open stream: continued - 3 -

            Andy2500 wrote:
            "Erwin Moller"
            <Since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c omwrote in
            message news:473db017$0 $229$e4fe514c@n ews.xs4all.nl.. .
            >>
            >Well, if you don't know that, find out!
            >PHP runs on IIS as IUSR_<machinena me>
            >>
            >Find that user, and make sure that user has write right on the
            >uploaddirector y.
            >>
            >>
            >
            I found it ! youpi !!!! ( the write right on directory in IIS )
            thank to your big help.
            >
            Thank you very very very much
            and wish you an excellent week-end.
            >
            Thanks. Glad to be of help.
            Now do me a favor and get that Thunderbird newsreader in!
            ;-)

            Regards,
            Erwin Moller

            Comment

            Working...