I've got some PHP code that'll create a new file in a set directory:
$target_path = "reports/" . basename($Report_Filename) . ".php";
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { /* code here */ }
It was working perfectly, and has done for some years now, unfortunately we've just moved across to a new server, and I'm now getting this error:
[15-Jul-2010 16:15:48] PHP Warning: Unknown: open_basedir restriction in effect. File(C:\Windows\TEMP\) is not within the allowed path(s): (C:\inetpub\wwwroot) in Unknown on line 0
[15-Jul-2010 16:15:48] PHP Warning: File upload error - unable to create a temporary file in Unknown on line 0
Any suggestions on a way around this please? I've checked the permissions on the folders (both the folder I want to upload to, and the Windows TEMP folder) with no joy. I've also tried a couple of tweaks to the php.ini file and in particular the 'open_basedir' line, but no luck with that either.
Thanks
I've also tried a couple of tweaks to the php.ini file and in particular the 'open_basedir' line, but no luck with that either
Then try again - you did it wrong the first time. Maybe there's another setting elsewhere (e.g. in the webserver config).
Failing that, find out what the open_basedir is and make sure that your upload_tmp_dir in php.ini and the $target_path in your code are both inside it.
C.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With