Page 1 of 1

"Safe Mode" errors

Posted: Wed Oct 08, 2003 11:04 pm
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

Posted: Wed Oct 08, 2003 11:10 pm
by volka
what's the value of $location?
seems like you're trying to write to / (root-directory)

Posted: Thu Oct 09, 2003 12:08 am
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.