I'm having a problem with my upload script. it appears that my hosts safe mode is prohibiting me from moving my uploaded temporary file to a permanant file in a directory. This is the error I get.
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 643 is not allowed to access /home/virtual/site139/fst/var/www/html/gpx-files/Al owned by uid 48 in /home/virtual/site139/fst/var/www/cgi-bin/includes/upload_class.php on line 155
Back
Here is what they (mediatemple.net) says.
Here is the part of my code that attemps to move the file, I'm using Easy PHP Upload ver. 2.31 from finalwebsites.
I guess I need a cgi script to do this. Can someone help me out with this. I don't remember much Perl anymore and I don't know how to integrate it with the PHP. Can I use a perl module to just do the moving called from within my PHP script?
Thanks
Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 643 is not allowed to access /home/virtual/site139/fst/var/www/html/gpx-files/Al owned by uid 48 in /home/virtual/site139/fst/var/www/cgi-bin/includes/upload_class.php on line 155
Back
Here is what they (mediatemple.net) says.
I tried creating a .htaccess file like they mentioned, but it still didn't work.Another alternative, which consists of running php *as* a cgi while processing certain php scripts. This runs php with safe mode off, but as a separate process and as your user. Your php scripts will take a small performance hit when running in cgi mode compared to running in the 'normal' way, so we only suggest using this method on the scripts that need non-safe mode access.
1. Create a directory in which you'll place your php scripts that you want to have run in CGI mode. For this example, we'll use 'phpcgi'
2. In that directory, create a .htaccess file (KB article: What is an .htaccess file) with the following contents:
Action php-script /interpreters/php-script
AddHandler php-script .php
AddHandler php-script .php3
Any php scripts that you place in that directory will now be executed by cgi-mode php.
NOTES:
The workaround method listed in this document may not work correctly with all scripts or with alternate domains. In that case the most viable options include:
* Rewriting the script as CGI which doesn't have safe mode restrictions
Here is the part of my code that attemps to move the file, I'm using Easy PHP Upload ver. 2.31 from finalwebsites.
Code:
[LEFT]if (move_uploaded_file($tmp_file, $newfile)) {
umask(0);
chmod($newfile , 0644);
return true;
} else {
return false;
}[/LEFT]
Thanks