473,756 Members | 5,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.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_fil e() 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 3374
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_f ile()
function. The warnings echo'ed are:
Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to open
stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
line 108

Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.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_fil e() 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*****@firstd basource.com> wrote in message
news:uE******** *********@newss vr23.news.prodi gy.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_f ile()
function. The warnings echo'ed are:
Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to open stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on
line 108

Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.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_fil e() 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******** ***********@twi ster.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*****@firstd basource.com> wrote in message
news:uE******** *********@newss vr23.news.prodi gy.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_f ile()
function. The warnings echo'ed are:
Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to open stream: Permission denied in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.php on line 108

Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.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_fil e() 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******** ***********@twi ster.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*****@firstd basource.com> wrote in message
news:uE****** ***********@new ssvr23.news.pro digy.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_f ile()
function. The warnings echo'ed are:
Warning: move_uploaded_f ile(images/nieuws/TIDEEY%7E1.jpg) : failed to


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

Warning: move_uploaded_f ile(): Unable to move '/tmp/phphEjKUh' to
'images/nieuws/TIDEEY%7E1.jpg' in
/scout/users/yyy/public_html/cgi-bin/pictures/class.UploadPic ture.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_fil e() 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
7647
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 file: ".$_FILES." -> $imagefile"); } else { enter record into database...
1
3017
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 it from /tmp. That's why I used move_uploaded_file() to move the file to /home/CUSTOMER/DOMAIN/tmp/FILENAME: ======================================================
1
10682
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 minimum. simpleupload.php <form enctype="multipart/form-data" action="upload.php" method="post"> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="200000"/>
1
2704
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 correct for further processing. Php code page that downloads pictures modifies this picturecatalog -page, that shows those pictures. Hmm, I want it to show. Everything else is ok and working but picture rights do not allow pictures to be viewed. I
2
16298
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 I change it to 777 it does upload but the owner is www-data, but I then can't download it using a FTP client (which I have to do) as it's the wrong owner, so I have to leave the chomd as 755, but
1
4237
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 = $this->sfug->getUUID();
5
3373
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 />"; } ------------------------ When I try to move the file using move_uploaded_file it fails. --------------
4
2308
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 directory where the file is before the move. I would chmod /tmp itself but wouldn't that be a big security risk? is there another solution? Thanks for any help you can provide...
3
7608
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 PHP 5.2.5 on my PC running Apache 2.0. Thanks. <?php $uploadDir = "/uploads"; $temp = $uploadDir;
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
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
10046
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...
1
9857
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
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6542
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3817
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
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
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.