leequalls Posted January 6, 2010 Share Posted January 6, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/187433-function-copy-warning/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 6, 2010 Share Posted January 6, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/187433-function-copy-warning/#findComment-989756 Share on other sites More sharing options...
leequalls Posted January 6, 2010 Author Share Posted January 6, 2010 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>"; } } Quote Link to comment https://forums.phpfreaks.com/topic/187433-function-copy-warning/#findComment-989764 Share on other sites More sharing options...
PFMaBiSmAd Posted January 6, 2010 Share Posted January 6, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/187433-function-copy-warning/#findComment-989774 Share on other sites More sharing options...
leequalls Posted January 6, 2010 Author Share Posted January 6, 2010 I have made those changes and I am still getting the warning message Quote Link to comment https://forums.phpfreaks.com/topic/187433-function-copy-warning/#findComment-989791 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.