473,387 Members | 1,925 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,387 software developers and data experts.

A little problem with move_uploaded_file()

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

Jan 21 '07 #1
4 2283
Batmanuel wrote:
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...
double check, I would guess that you do not have permissions for
the target directory. I ran into the same problem and had to
chmod to give other write to that directory, which is a problem.

move_uploaded file runs with the php or apache user, not you.

bill
Jan 21 '07 #2
"Batmanuel" <an**********@gmail.comwrote in news:1169342255.121748.236010
@l53g2000cwa.googlegroups.com:
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...
Did you notice the /tmp folder should exist on your webserver, not on your
local drive? I made that mistake earlier and it took me quite some time to
solve the problem...
--
Siebie
Jan 21 '07 #3
On Jan 20, 5:17 pm, "Batmanuel" <antonioet...@gmail.comwrote:
I would chmod /tmp itself but wouldn't
that be a big security risk? is there another solution?
Giving the target directory write permissions isn't necessarily a big
risk, but you do need to try and ensure that your scripts can't be used
to move arbitrary files to the target directory, so check content-type
and file extension.
--
Curtis

Jan 22 '07 #4


On Jan 20, 9:17 pm, "Batmanuel" <antonioet...@gmail.comwrote:
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...
Well, I've long since fixed it and shamefully forgot to check my thread
here. I apologize for that, guys.
>double check, I would guess that you do not have permissions for
the target directory. I ran into the same problem and had to
chmod to give other write to that directory, which is a problem.

move_uploaded file runs with the php or apache user, not you.

bill
Yup, that was mostly it. I'll try to make it so that only the apache
user has permissions now that you mention it. Its probably safer that
way.
>Did you notice the /tmp folder should exist on your webserver, not on your
local drive? I made that mistake earlier and it took me quite some time to
solve the problem...
Excellent point, I hadn't noticed that but I ended up making a temp
folder of my own just for the purposes of the site so wouldn't have to
mess with the permissions of my /tmp directory.
>Giving the target directory write permissions isn't necessarily a big
risk, but you do need to try and ensure that your scripts can't be used
to move arbitrary files to the target directory, so check content-type
and file extension.
--
Curtis
Will do. Thanks for the input guys and again, I'm sorry I forgot about
this topic here.

Jan 25 '07 #5

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

Similar topics

1
by: sean | last post by:
hi Firstly i am working with php in an enviroment that supports unix-like permission in an accademic environment. The problem is enabling my script to upload a image file to my home folder,...
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...
6
by: Stijn Goris | last post by:
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...
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 />"; }...
3
chunk1978
by: chunk1978 | last post by:
hi there... i have a form where a user may optionally upload a maximum of 2 files along with other textual data (there are 2 file fields built in the form). i'm having trouble writing a php script...
8
by: The Natural Philosopher | last post by:
This is so weird. What I am trying to do is to upload files and stuff them in a mysql database. Everything works except the file content is zero. using the load_file command from mysql...
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...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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...
0
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...

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.