Hello all, I've been reading all the upload problem posts and still can't determine how to fix my upload problem. Here is my php script:<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->if (is_uploaded_file($temp_file_name)) {<br />Â Â Â Â Â Â Â Â Â Â Â Â if (move_uploaded_file($temp_file_name, $upload_dir.$file_name)) {<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $log = $upload_log_dir.$y."_".$m."_".$d.".txt";Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //Log File Name<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $fp = fopen($log,"a+");Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //Set File Pointer<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â fwrite($fp,"\n$ip | $file_name | $screen_size | $date | $time");Â Â Â Â //Write File<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â fclose($fp);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â //Close File Pointer<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $_SESSION['result'] = "green";<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return TRUE;<br />Â Â Â Â Â Â Â Â Â Â Â Â } else {<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â $_SESSION['result'] = "brown";<br />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â return FALSE;<!--c2--></div><!--ec2--><br /><br />The returns error that I get is:<br /><br />"Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/upload/20.pdf) is not within the allowed path(s): (/home/******:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/*****/public_html/account/scripts/upload.php on line 202"<br /><br />I've kinda picked up on the fact that I need to change some settings in htaccess?<br /><br />Thanks so much guys - You're the best!<br /><br />-Bennett<!--content-->
Hi Bennett, <br /><br />Welcome to the forums <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /> <br /><br />You are trying to upload to "/upload/20.pdf" which is not allowed. You neet to set it to upload to "/home/*****/public_html/upload/20.pdf" (or wherever you want to upload it to that is in your allocated space. <br /><br />If you change the variable $upload_dir to include the full path, you should be fine.<!--content-->
Welcome to the forum, Bennett. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Thanks a bunch!<br /><br />I can upload the files now but when I try to write to the log file I get another error. Any ideas?<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Warning: fopen(/home/******/public_html/upload/upload_logs/2006_09_28.txt) [function.fopen]: failed to open stream: Permission denied in /home/******/public_html/account/scripts/upload.php on line 204<br /><br />Warning: fwrite(): supplied argument is not a valid stream resource in /home/******/public_html/account/scripts/upload.php on line 205<br /><br />Warning: fclose(): supplied argument is not a valid stream resource in /home/******/public_html/account/scripts/upload.php on line 206<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />I set the permission of /upload/ to 777 but I still get the same thing. Do I need to do this to another folder/file or are fwrite and fclose allowed?<br /><br />Thanks again,<br /><br />Bennett<!--content-->
Have you changed the permissions to upload_logs ?<!--content-->
Welcome to the forum, Bennett <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums Bennett<!--content-->
Hi Bennett, <br /><br />Welcome to the forums <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /> <br /><br />You are trying to upload to "/upload/20.pdf" which is not allowed. You neet to set it to upload to "/home/*****/public_html/upload/20.pdf" (or wherever you want to upload it to that is in your allocated space. <br /><br />If you change the variable $upload_dir to include the full path, you should be fine.<!--content-->
Welcome to the forum, Bennett. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Thanks a bunch!<br /><br />I can upload the files now but when I try to write to the log file I get another error. Any ideas?<br /><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Warning: fopen(/home/******/public_html/upload/upload_logs/2006_09_28.txt) [function.fopen]: failed to open stream: Permission denied in /home/******/public_html/account/scripts/upload.php on line 204<br /><br />Warning: fwrite(): supplied argument is not a valid stream resource in /home/******/public_html/account/scripts/upload.php on line 205<br /><br />Warning: fclose(): supplied argument is not a valid stream resource in /home/******/public_html/account/scripts/upload.php on line 206<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />I set the permission of /upload/ to 777 but I still get the same thing. Do I need to do this to another folder/file or are fwrite and fclose allowed?<br /><br />Thanks again,<br /><br />Bennett<!--content-->
Have you changed the permissions to upload_logs ?<!--content-->
Welcome to the forum, Bennett <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid="" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums Bennett<!--content-->