dragongamer Posted March 24, 2006 Share Posted March 24, 2006 ok using php form gen and making some changes i am just left with one proplem, when i enter the data then post it it says,[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Warning: copy(games/1.swf): failed to open stream: No such file or directory in /mounted-storage/home15a/sub003/sc17688-TROC/www/modules/Flash_Games/submit_code.php on line 41Warning: copy(images/screenshot/2nd.gif): failed to open stream: No such file or directory in /mounted-storage/home15a/sub003/sc17688-TROC/www/modules/Flash_Games/submit_code.php on line 44[/quote]ok here is the code[code]<?phpif(!defined('MODULE_FILE')) { header("Location: ../../index.php"); exit;}require_once("mainfile.php");$module_name = basename(dirname(__FILE__));get_lang($module_name);include("header.php");$index = 1;OpenTable();include("global.inc.php");$errors=0;$error="The following errors occured while processing your form input.<ul>";pt_register('POST','gamename');$gamefile=$HTTP_POST_FILES['gamefile'];$gameimagefile=$HTTP_POST_FILES['gameimagefile'];pt_register('POST','description');$description=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $description);pt_register('POST','authorsname');pt_register('POST','authorssite');pt_register('POST','hightpx');pt_register('POST','widthpx');pt_register('POST','backroundcolor');if($gamename=="" || $gamefile=="" || $gameimagefile=="" || $description=="" || $hightpx=="" || $widthpx=="" || $backroundcolor=="" ){$errors=1;$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";}if(!is_uploaded_file($HTTP_POST_FILES['gamefile']['tmp_name'])){$error.="<li>The file, ".$HTTP_POST_FILES['gamefile']['name'].", was not uploaded!";$errors=1;}if(!is_uploaded_file($HTTP_POST_FILES['gameimagefile']['tmp_name'])){$error.="<li>The file, ".$HTTP_POST_FILES['gameimagefile']['name'].", was not uploaded!";$errors=1;}if($errors==1) echo $error;else{$image_part = $HTTP_POST_FILES['gamefile']['name'];$image_list[1] = $image_part;copy($HTTP_POST_FILES['gamefile']['tmp_name'], "games/".$image_part);$image_part = $HTTP_POST_FILES['gameimagefile']['name'];$image_list[2] = $image_part;copy($HTTP_POST_FILES['gameimagefile']['tmp_name'], "images/screenshot/".$image_part);$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));$gcid=10;$link = mysql_connect("**********","********","*******");mysql_select_db("********",$link);$query="insert into nuke_flashgames_games (gcid,gname,gfilename,gimage,gdescription,gauthorname,gauthorurl,gheight,gwidth,gcolor) values ('".$gcid."','".$gamename."','".$image_list[1]."','".$image_list[2]."','".$description."','".$authorsname."','".$authorssite."','".$hightpx."','".$widthpx."','".$backroundcolor."')";mysql_query($query);?><!-- This is the content of the Thank you page, be careful while changing it --><h2>Thank you!</h2><table width=50%><tr><td>game name: </td><td> <?php echo $gamename; ?> </td></tr><tr><td>game file: </td><td> <?php echo $gamefile; ?> </td></tr><tr><td>game image file: </td><td> <?php echo $gameimagefile; ?> </td></tr><tr><td>description: </td><td> <?php echo $description; ?> </td></tr><tr><td>authors name: </td><td> <?php echo $authorsname; ?> </td></tr><tr><td>authors site: </td><td> <?php echo $authorssite; ?> </td></tr><tr><td>hight px: </td><td> <?php echo $hightpx; ?> </td></tr><tr><td>width px: </td><td> <?php echo $widthpx; ?> </td></tr><tr><td>backround color: </td><td> <?php echo $backroundcolor; ?> </td></tr></table><!-- Do not change anything below this line --><?php }CloseTable();include("footer.php");?>[/code]i have blnked out data conecting with ***** so just in case yu thinks its an error, thank you! Quote Link to comment https://forums.phpfreaks.com/topic/5707-php-upload/ Share on other sites More sharing options...
mhoctober Posted March 24, 2006 Share Posted March 24, 2006 DragonGamer...the folder that the file is being uploaded to - check permissions. I have seen this error occur when permissions on the folder on the server are not set correctly. Quote Link to comment https://forums.phpfreaks.com/topic/5707-php-upload/#findComment-20354 Share on other sites More sharing options...
dragongamer Posted March 24, 2006 Author Share Posted March 24, 2006 yep both dir have been chmoded to 777, i was thinking it may be to due to the temp dir in the php script? Quote Link to comment https://forums.phpfreaks.com/topic/5707-php-upload/#findComment-20380 Share on other sites More sharing options...
dragongamer Posted March 24, 2006 Author Share Posted March 24, 2006 ok in stead of the copy function i now placed move_uploaded_file now i get a different error[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: move_uploaded_file(games/1.swf): failed to open stream: No such file or directory in /mounted-storage/home15a/sub003/sc17688-TROC/www/modules/Flash_Games/submit_code.php on line 41Warning: move_uploaded_file(): Unable to move '/tmp/phpTgIKlG' to 'games/1.swf' in /mounted-storage/home15a/sub003/sc17688-TROC/www/modules/Flash_Games/submit_code.php on line 41Warning: move_uploaded_file(images/screenshot/2nd.gif): failed to open stream: No such file or directory in /mounted-storage/home15a/sub003/sc17688-TROC/www/modules/Flash_Games/submit_code.php on line 44Warning: move_uploaded_file(): Unable to move '/tmp/phpb6n6UL' to 'images/screenshot/2nd.gif' in /mounted-storage/home15a/sub003/sc17688-TROC/www/modules/Flash_Games/submit_code.php on line 44[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/5707-php-upload/#findComment-20421 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.