Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

File Uplopder - Warning: open_basedir restriction in effect.

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

File Uplopder - Warning: open_basedir restriction in effect.

Postby Mohan » Fri Oct 11, 2002 9:13 pm

Hi I am facing problem while uploading file. It gives me error -

Warning: open_basedir restriction in effect. File is in wrong directory in /usr/local/plesk/apache/vhosts/mahanandmilk.com/httpdocs/phpUpload.php3 on line 17

Please help me. I am giving my code also. Pl. help me...

<html>
<body>
<?
if (isset($users_file)) {
echo "<B>Remote File Name:</B> $users_file<BR>";
echo "<B>Local File Name:</B> $users_file_name<BR>";
echo "<B>Local File Size:</B> $users_file_size<BR>";
if (isset($users_file_type)) {
echo "<B>Local File Type:</B> $users_file_type<P>"; }

// Change $doc_directory to your 'DocumentRoot'.
$doc_directory ="/usr/local/plesk/apache/vhosts/mahanandmilk.com/httpdocs/";
$my_file = "tmp/uploaded-".$users_file_name;
$copy_path =$doc_directory.$my_file;

if ($users_file != "none") {
if(!copy($users_file, $copy_path)) {
echo "File upload failed!"; }
else { ?><A HREF="<? echo $my_file; ?>">Upload Complete!</A>
<? } }
else { echo "<P>You must select a file to upload!<P>"; ?>
<A HREF="<? echo $PHP_SELF; ?>"><B>Back</B></A> to the Upload Form
<? } }

else { ?>
<form action="<? echo $PHP_SELF; ?>"
enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="20000" />
<input type="file" name="users_file" /><br />
<input type="submit" value="Upload!" />
</form><? } ?>

</body>
</html>
Mohan
New php-forum User
New php-forum User
 
Posts: 5
Joined: Fri Oct 11, 2002 8:17 pm

Postby DoppyNL » Sat Oct 12, 2002 12:14 am

I'm not sure, but I think that you're not allowed to open a file on that location because of security reasons.
you will have to move uploaded files to a location where you can open them first, you will have to use the function move_uploaded_file for that.

Greetz Daan
DoppyNL
 


Return to PHP coding => General

Who is online

Users browsing this forum: Google Feedfetcher and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.