473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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_file()
function. The warnings echo'ed are:
Warning: move_uploaded_file(images/nieuws/TIDEEY%7E1.jpg): failed to open
stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.php on
line 108

Warning: move_uploaded_file(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.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_file() which returns no errors at all. The
nieuws dir has 766 rules applied.

Maybee someone can help me out?

Thanks
Stijn
Jul 17 '05 #1
6 3334
Stijn Goris wrote:
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_file()
function. The warnings echo'ed are:
Warning: move_uploaded_file(images/nieuws/TIDEEY%7E1.jpg): failed to open
stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.php on
line 108

Warning: move_uploaded_file(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.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_file() which returns no errors at all. The
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 into the
directory.

--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Jul 17 '05 #2
Ken
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" <ma*****@firstdbasource.com> wrote in message
news:uE*****************@newssvr23.news.prodigy.co m...
Stijn Goris wrote:
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_file()
function. The warnings echo'ed are:
Warning: move_uploaded_file(images/nieuws/TIDEEY%7E1.jpg): failed to open stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.php on
line 108

Warning: move_uploaded_file(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.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_file() which returns no errors at all. The 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

into the directory.

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

Jul 17 '05 #3

"Ken" <kk******@wi.rr.com> wrote in message
news:o7*******************@twister.rdc-kc.rr.com...
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" <ma*****@firstdbasource.com> wrote in message
news:uE*****************@newssvr23.news.prodigy.co m...
Stijn Goris wrote:
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_file()
function. The warnings echo'ed are:
Warning: move_uploaded_file(images/nieuws/TIDEEY%7E1.jpg): failed to open stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.php on line 108

Warning: move_uploaded_file(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.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_file() which returns no errors at all. The 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

into the
directory.

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



problem solved, thanks.

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

regards
Jul 17 '05 #4
*** Stijn Goris wrote/escribió (Tue, 10 Aug 2004 10:05:45 +0200):
Why do I need 777. Is write and read acces not enough?


Without access permission you can read and write files--you just can't get
directory listings.
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #5
Stijn Goris wrote:
"Ken" <kk******@wi.rr.com> wrote in message
news:o7*******************@twister.rdc-kc.rr.com...
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" <ma*****@firstdbasource.com> wrote in message
news:uE*****************@newssvr23.news.prodigy. com...
Stijn Goris wrote:
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_file()
function. The warnings echo'ed are:
Warning: move_uploaded_file(images/nieuws/TIDEEY%7E1.jpg): failed to


open
stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.php
on
line 108

Warning: move_uploaded_file(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPicture.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_file() which returns no errors at all.


The
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


into the
directory.

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



problem solved, thanks.

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


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 - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
Jul 17 '05 #6
>> Why do I need 777. Is write and read acces not enough?

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


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
Jul 17 '05 #7

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

Similar topics

5
by: neo002244 | last post by:
The move_uploaded_file() function is very quirky. I want to allow users to upload images to the Web site. Here is the code: if(!move_uploaded_file($_FILES, $imagefile)) { die("Could not move...
1
by: Felix Natter | last post by:
hi, I would like to upload a file (via a form), then read that (temporary) file and write the contents into a database. The first problem is that open_basedir=/home/CUSTOMER so I can't just read...
1
by: sa | last post by:
Trying to upload a file using win xp/iis/php. I've given full access to all accounts trying to get this to work? Yet I'm still getting read errors. Simplified the script below to the bare...
1
by: PeterFI | last post by:
Hello, my problem is as follows, I have a web page where user can upload pictures to unix server from his own computer. Pictures are uploaded fine, but the rights of those files are not...
2
by: Brian | last post by:
Hi I am moving a site to a new server, I have been testing it and one of the pages uses move_uploaded_file, but I get a Permission denied. The directory I am moving it to is chomd of 755, if...
1
by: comp.lang.php | last post by:
Consider my code: if ($this->isSuccessful && is_file($_FILES)) { // STEP 6: MOVE RESUME TO DIRECTORY $uuid = $this->sfug->getUUID(); if (!$uuid) $this->sfug->setUUID(); $uuid =...
5
by: bill | last post by:
I can validate that the file uploaded because is_uploaded_file() returns true. --------- if (is_uploaded_file($_FILES)) { echo "File ". $_FILES ." uploaded successfully.<br />"; }...
4
by: Batmanuel | last post by:
Good evening people, little question here... I'm trying to get this file upload script to work but it tells me that move_uploaded_file() fails because it doesn't have permission for the /tmp...
3
by: groupie | last post by:
Hi, The code below is working - it returns the 'Received' message, however I cannot find the uploaded file in the destination folder, or anywhere else (other than source directory). I'm running...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.