Jump to content

PHP upload


dragongamer

Recommended Posts

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 41

Warning: 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]<?php
if(!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)/","&nbsp;<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!
Link to comment
Share on other sites

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 41

Warning: 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 41

Warning: 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 44

Warning: 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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.