Jump to content

Recommended Posts

Warning: copy() [function.copy]: open_basedir restriction in effect. File() is not within the allowed path(s): (/home/party:/usr/lib/php:/usr/php4/lib/php:/usr/local/lib/php:/usr/local/php4/lib/php:/tmp) in /home/party/public_html/en/djpanel/admin/createprofile.php on line 51

 

I received the above warning when uploading a picture that was 2.98 MB I then tried to upload a picture size 51.47 KB and it went through no problem. How do I fix this warning?

Link to comment
https://forums.phpfreaks.com/topic/187433-function-copy-warning/
Share on other sites

The upload of the larger size file is probably failing due to upload size restrictions on your server, but your code has no error checking logic in it to prevent the copy() statement from being executed when there is no actual valid source or destination file, so you get an error out of the copy() statement. But that's just a guess since you did not post any code.

this is the code

 

$uploaded = $HTTP_POST_FILES['ufile']['name'][0]; 
$path1= "/home/party/public_html/en/images/profile/$uploaded";

if($uploaded != NULL) { 
   if(copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1)) {
        $profile = "good"; 
        $success = $success . "The profile file $uploaded has been uploaded<p>"; 
    }
              else { $error = $error . "<h1>Sorry, there was a problem uploading profile image.</h1><p>"; }
}

You should actually be checking the ['error'] element and only processing the file if the error value is 0. Uploads that fail with an error that would cause the ['name'] element to be empty, set it to an empty string, not a NULL value.

 

$HTTP_POST_FILES was depreciated long ago in php4.1, turned off by default in php5, and completely removed in php6. Use $_FILES instead.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.