upload file on unix

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
navid
Forum Commoner
Posts: 68
Joined: Tue Sep 24, 2002 3:14 am
Location: iran

upload file on unix

Post by navid »

hi
I have a problem in unix!

I have a script on windows server.
this script upload a file from client to a folder on windows server.
this script worked successfully on windows server.
then I ftp this script on unix server successfully. but when I run this script the progrom get me warning.

server can not copy file into my folder on unix???????????
please help me .
the html file source is:
//-----------------//
<html>
.
.
.
<body>
<form method="post" action="copy.php" enctype="multipart/form-data">
file: <input type="file" name="f1">
<input type="submit">
</form>
.
.
.
//----------------//

and the php file source is:
//-----------------//
<?php
if(copy($f1,$f1_name))
echo "ok";
else
echo "no copy";
?>
//----------------//
and the server warning is:
//---------------//
Warning: open_basedir restriction in effect. File is in wrong directory in ........... basic/copy.php on line 1
//--------------//

thank
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Open_basedir restriction is a consequence of Safe-Mode.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Stick:

Code: Select all

&lt;php phpinfo(); ?&gt;
into a file and check out how your host has configured PHP and especially safe mode. Then look in the manual to find out what you can or cannot do based on the restrictions that have been set.

Mac
navid
Forum Commoner
Posts: 68
Joined: Tue Sep 24, 2002 3:14 am
Location: iran

i have old problem

Post by navid »

nielsene wrote:Open_basedir restriction is a consequence of Safe-Mode.
hi dear
safe mode on php.ini is "on"
i modify it and change value of safe mode
now the safe mode on php.ini is "off".
but i have old problem. :?:
navid
Forum Commoner
Posts: 68
Joined: Tue Sep 24, 2002 3:14 am
Location: iran

i find answer my question

Post by navid »

i very happy .
because i find answer my question.i think my problem is big!
i work on this problem 3day and then find answer this.

when we can not copy with copy() function we use move_uploaded_file() function

this function have top secure.
this function is easy.

i suggest to use move_uploaded_file() instead of copy(),always.
:lol:
Post Reply