ohdang888 Posted December 25, 2007 Share Posted December 25, 2007 heres my code for people to upload a file to my site. i know its simple... <center> <font size=4> Upload a game to www.TheGameKing.Net! <br> <font size=2> <form method="post" action="thanks.php" enctype="multipart/form-data"> Name of Game:<input type="text" size="15" maxlength="30" name="game_name"/> <br/> Your First and Last Name:<input type="text" size="15" maxlength="50" name="name"/> <br/> Your E-mail Address:<input type="text" size="15" maxlength="30" name="email"/> <br/> Short Description of your game (10 words or less):<input type="text" size="15" maxlength="90" name="short"/> <br/> Long Description (between 15-30 words):<input type="text" size="30" maxlength="280" name="long"/> <br/> Possible Tags(list 4-8 words that describe your game (seperate by comma):<input type="text" size="15" maxlength="30" name="tags"/> <br/> Game dimensions(width x height,px) :<input type="text" size="15" maxlength="30" name="size"/> <br/> <font size=3> Pick the category of game that best decribes the game<font size=2><br> Action: <input type="radio" name="category" value="action" /> <br/> Sport/Racing: <input type="radio" name="category" value="sport" /> <br/> Puzzle: <input type="radio" name="category" value="puzzle" /> <br/> Strategy/Board: <input type="radio" name="category" value="board" /> <br/> Classic/Arcade: <input type="radio" name="category" value="classicandarcade" /> <br/> People: <input type="radio" name="category" value="people" /> <br/> <font size=3> Would you like your game to be sponsored by TheGameKing.Net?? To find out more, click <a href="http://localhost/sponsor.php">here</a> <br><font size=2> If you say "yes", then you are saying you agree to the terms of sponsorship. <br> <select name="sponsor"> <option value="yes">yes</option> <option value="no">no</option></select><br /> <input type="hidden" name="MAX_FILE_SIZE" value="20000000" /> Choose a file to upload(use .zip): <input name="uploadedfile" type="file" /><br /> <input type="submit" name="submit" value="Submit"/> </form> <?php $gamename = $_POST["game_name"]; $person_name = $_POST["name"]; $short = $_POST["short"]; $long = $_POST["long"]; $tags = $_POST["tags"]; $size = $_POST["size"]; $category = $_POST["category"]; $sponsor = $_POST["sponsor"]; $FH1 = fopen($gamename, 'w') or die("can't create file, contact ADMIN"); fwrite($FH1,$gamename); fclose($FH1); $FH2 = fopen($gamename, 'a') or die("can't write to file, contact ADMIN"); fwrite($FH2,$person_name . "/n"); fwrite($FH2,$short . "/n"); fwrite($FH2,$long . "/n"); fwrite($FH2,$tags . "/n"); fwrite($FH2,$size . "/n"); fwrite($FH2,$category . "/n"); fwrite($FH2,$sponsor . "/n"); fclose($FH2); ?> first of all, what php coe owuld i use to store the uploaded file into the same directory as this page. also, is nots working! i tried taking away the file upload stuff and "multi-part form data" part, but it still won't work. WHATS WRONG?!?!??! Quote Link to comment https://forums.phpfreaks.com/topic/83096-forms-trouble-help/ 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.