"Safe Mode" errors

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Slippy
Forum Contributor
Posts: 113
Joined: Sat Jul 12, 2003 11:31 pm
Location: Vancouver eh!

"Safe Mode" errors

Post by Slippy »

I am trying to upload files to a directory using PHP. I have encountered a "Safe Mode" error; and I can't seem to find a way around it.

Error:
Warning: copy(): SAFE MODE Restriction in effect. The script whose uid is 579 is not allowed to access / owned by uid 0 in /home/virtual/site72/fst/var/www/html/cms/projects.php on line 94

Warning: copy(/projectfiles/filename.pdf): failed to open stream: No such file or directory in /home/virtual/site72/fst/var/www/html/cms/projects.php on line 94

Error, failed to copy file
Here is the code (from line 94):

Code: Select all

// Copy the file
if (copy($fileUpload, $location)) 
	{
	  echo "<h1>File Uploaded</h1>";
	&#125; else &#123;
	  echo "<h1>Error, failed to copy file</h1>";
	&#125;
I can sucessfully upload the file into a MySQL database using the same form, but the filesize limitation is 1MB (mySQL limitation). So I was hoping to get this working using the file system. Any suggestions as to what to do would be appreciated.

The manual suggests that there may be no "easy" way around this
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

what's the value of $location?
seems like you're trying to write to / (root-directory)
User avatar
Slippy
Forum Contributor
Posts: 113
Joined: Sat Jul 12, 2003 11:31 pm
Location: Vancouver eh!

Post by Slippy »

The virtual host directory is: /var/usr/html/projects/

The "real - world" directory appears to be: /home/virtual/site72/fst/var/www/html/projects/

When I prefixed my file with the "Real - world" directory ... the error went away.

So, true enough, my $location varialbe was off... thanks.
Post Reply