views:

397

answers:

4

I'm working with a legacy php script. There is a file upload form in it already, but I've added another one for a different section in the same script.

The $_file['file'] is there. But I keep getting a open_basedir restriction error, and if not that, I get a permission error.

I wouldn't mind working around these problems, but the thing is, the other form works fine. There are no differences in where the scripts are (same dir), nor are there any problems in where the files are going (I tried different dir, and same dir).

I'm going absolutely bat crazy trying to figure this out. Why is my file form not working? Why does it work for the other code? What is going on?

+1  A: 

I've had similar issues which turned out to be to do with incorrect setting of the /tmp directory by the hosting provider (i.e. where PHP stores the temporary upload file). Might be worth a call to tech support.

da5id
+1  A: 

Doesn't it have to be $_FILE['file'] instead of $_file['file']?

Evan Fosmark
More like $_FILES["file"]
random
A: 

i dont know if you suffer from the same problem, but some time ago we had a problem with open_basedir and smarty. we were receiving problem from smarty code, but the problem was bad include_path (we were setting it through ini_set but without concatenating it with old include_path). in the result smarty tried to check if directory was readable creating possible path from root directory / which violated open_basedir. to sum up, check where do you get open_basedir error, what is the path that causes the problem.

empi
+1  A: 

safe mode forces move_uploaded_file() to check whether the files or directories being operated upon have the same UID (owner) as the script that is being executed.

I would also recommend looking for ini_set() statements in the working code.

Bob Fanger