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

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

am 16.11.2007 10:06:17 von Andy2500

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


Hi ! Thank you for the reply

>> >>
>> 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=$tmp_file


";
> $target = $content_dir . $name_file;
> echo "\$target=$target
";
>
> What output does that give?

$tmp_file=C:\WINNT\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_file(upload/Guitarre.jpg)
[function.move-uploaded-file]: failed to open stream: Permission denied in
C:\Inetpub\wwwroot\simple.php on line 27

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

Impossible copy into the folder upload

Re: failed to open stream: continued - 3 -

am 16.11.2007 11:47:23 von BoneIdol

On 16 Nov, 09:06, "Andy2500" wrote:
> the reply doesn't work, I much post a new one , sorry !!!!!
>
> Hi ! Thank you for the reply
>
>
>
> >> >
> >> 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=$tmp_file


";
> > $target = $content_dir . $name_file;
> > echo "\$target=$target
";
>
> > What output does that give?
>
> $tmp_file=C:\WINNT\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_file(upload/Guitarre.jpg)
> [function.move-uploaded-file]: failed to open stream: Permission denied in
> C:\Inetpub\wwwroot\simple.php on line 27
>
> Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move
> 'C:\WINNT\TEMP\php1C.tmp' to 'upload/Guitarre.jpg' in
> C:\Inetpub\wwwroot\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/features.file-upload.errors.php

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

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

am 16.11.2007 15:52:43 von Erwin Moller

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:
www.mozilla.com/thunderbird/

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?

>
>>> >>>
>>> 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=$tmp_file


";
>> $target = $content_dir . $name_file;
>> echo "\$target=$target
";
>>
>> What output does that give?
>
> $tmp_file=C:\WINNT\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\wwwroot\somedirectory\upload\Guitarre.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_

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_file(upload/Guitarre.jpg)
> [function.move-uploaded-file]: failed to open stream: Permission
denied in
> C:\Inetpub\wwwroot\simple.php on line 27
>
> Warning: move_uploaded_file() [function.move-uploaded-file]: Unable
to move
> 'C:\WINNT\TEMP\php1C.tmp' to 'upload/Guitarre.jpg' in
> C:\Inetpub\wwwroot\simple.php on line 27
>
> Impossible copy into the folder upload
>
>
>

Re: failed to open stream: continued - 3 -

am 16.11.2007 21:53:01 von Andy2500

"BoneIdol" wrote in message
news:e96caa88-bd4d-42a8-a358-220b60793abe@e1g2000hsh.googleg roups.com...
>
> You could always just go...
>
> echo $_FILES['fichier']['error'];
>
> Then check the error code on
> http://www.php.net/manual/en/features.file-upload.errors.php
>
> 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

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

am 16.11.2007 21:58:01 von Andy2500

"Erwin Moller"
wrote in
message news:473db017$0$229$e4fe514c@news.xs4all.nl...
>
>
> Well, if you don't know that, find out!
> PHP runs on IIS as IUSR_
>
> 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.

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

am 19.11.2007 14:09:31 von Erwin Moller

Andy2500 wrote:
> "Erwin Moller"
> wrote in
> message news:473db017$0$229$e4fe514c@news.xs4all.nl...
>>
>> Well, if you don't know that, find out!
>> PHP runs on IIS as IUSR_
>>
>> 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.
>

Thanks. Glad to be of help.
Now do me a favor and get that Thunderbird newsreader in!
;-)

Regards,
Erwin Moller