• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

PHP: Uploading files in safe-mode

AndreVR

New Member
Hello, guys...

I´d like to know if it´s possible to upload files via a HTML from using a PHP script in a safe-mode config.

The problem is: move_uploaded_file() function doesn´t work, and I get this warning:

Warning: SAFE MODE Restriction in effect. The script whose uid is 14856 is not allowed to access /home/c/canaljpa/public_html/cadastro/6 owned by uid 48 in /home/c/canaljpa/public_html/cadastro/cadastrar.php on line 133

So... any way to go? Using another function? Overriding this UID check?

Ps: copy() function returns the same warning!
 
You are trying to upload the files in a directory whose UserID is different from the UserID of the script ,create a directory directly through a PHP script and then upload files in it . It happens often when you get space on free servers ,while registration process their scripts running with different UID's create your directory while your scripts run as different users.
try creating a directory through PHP script and then upload perhaps it would work.:)
 
I´ve already found a solution

I´ve already found a solution.....

I´ve written my script in another way..... It was creating a directory with mkdir(); and then, it was moving the file into this directory, with move_uploaded_file();

The problem was that directory was being created by Apache with this mkdir() and then.. you wouldn´t have permission to write a file into it....

I´ve made a little FTP connection class into my script.... the script first connects to my account via FTP, with my login and pass... then creates the directory.... and closes the connection.

The directory was then created by me, via FTP... and finally I could use move_uploaded_file to move the file into it. :D
 
Back
Top