473,788 Members | 2,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[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
Nov 16 '07 #1
5 2350
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.
Nov 16 '07 #2


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?
>
>><?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
Nov 16 '07 #3

"BoneIdol" <le*****@hotmai l.comwrote in message
news:e9******** *************** ***********@e1g 2000hsh.googleg roups.com...
>
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.

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
Nov 16 '07 #4

"Erwin Moller"
<Si************ *************** *************** @spamyourself.c omwrote in
message news:47******** *************@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.
Nov 16 '07 #5
Andy2500 wrote:
"Erwin Moller"
<Si************ *************** *************** @spamyourself.c omwrote in
message news:47******** *************@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
Nov 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4512
by: Bert | last post by:
I am new to all this testing server terminolgy. For the last 6 days I have read everything I can find on installing php/mysql, IIS as a testing server. IIS, MySQL, PHP installed and apparently working but since I have never had any experience with any of them I can't be sure. WinXP Pro IIS PHP 4.3.4.4
2
3591
by: gruddo | last post by:
Hi this is my first post. I have two webservers. I can run php code fine on one but not the other. Both webservers can read files only one can write. I have looked around at other posts and they point at not giving permissions to the apache user. I have chmod 777 the directory /var/www/html and the subdirectory test
1
3017
by: krishna5 | last post by:
My php program to resize an jpeg image is as follows, ?php // File and new size $filename = '\bala\testPHP\Lavanya\Kids2.jpeg'; //$filename = 'Kids2.jpeg'; $percent = 0.5; // Content type
4
3287
by: Claire DURAND | last post by:
Hi, I try to open a distant (not local) XML file in PHP to read an RSS feed. I can open an HTML page and read it with the file() function. But as soon as I try with a RSS feed instead of HTML and I try to read or open with file() or fopen(), it doesn't work, I have the following errors :
1
1555
by: daver | last post by:
I just loaded a sql file into mysql but when I go to the address of my website i get the following errors.Any advice Warning: main(templates/cre6.5/main_page.tpl.php): failed to open stream: No such file or directory in /home/www/sexyliving.cashbizplus.com/index.php on line 309 Warning: main(templates/cre6.5/main_page.tpl.php): failed to open stream: No such file or directory in /home/www/sexyliving.cashbizplus.com/index.php on line 309 ...
7
2693
by: diane100 | last post by:
Hi I am new to PHP and Smarty (I know only very basic things) and I need help with a warning message I get when I call a page in a browser. I purchased some software from a company who are no longer replying to my messages for help so I have decided to try and fix the many problems myself. I am receiving the following messages when loading any of my pages and some pages are not even showing at all. Warning:...
12
1746
by: duzhidian | last post by:
failed to open stream: No such file or directory I have the programs like this structure: a.php is locate at . b.php is located at ./lib c.php is located at ./lib/sublib a.php uses a function at b.php while b.php using a function at c.php
6
62768
by: Andy2500 | last post by:
Hi, I'd like to upload an image to a folder, then I have 3 diffrents examples but all of them give an error "failed to open stream: Permission denied", althrough the C:\Inetpub\wwwroot is not protected. Any suggestions would be helpful, thank you for your time.
3
4679
by: Andy2500 | last post by:
Sorry that I use the new post because when I replied in the old one, nothing display ! here is the code of the simplest example with its errors : ==========================================================
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10370
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10113
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5402
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.