You are here: Re: [PHP] failed to open stream: continued - 2 - « PHP Programming Language « IT news, forums, messages
Re: [PHP] failed to open stream: continued - 2 -

Posted by Erwin Moller on 11/16/07 10:38

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_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<hr>";
>> $target = $content_dir . $name_file;
>> echo "\$target=$target<hr>";
>>
>> 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_<machinename>

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
>
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация