Jump to content

Form Help w/ upload


clanstyles

Recommended Posts

case addserver:
				{
					if(isset($_POST['addserver']))
					{
						   	$serverinfo['name'] = $_GET['servername'];
						   	$serverinfo['pass'] = $_GET['serverpassword'];
						   	$serverinfo['enabled'] = $_GET['serverenabled'];
						   	
						   	if($serverinfo['enabled'] == "on")
						   		$serverinfo['enabled'] = true;
						   	else 
						   		$serverinfo['enabled'] = false;
						   	
						   	echo $_FILES['filename']['name'] . "<br />";
						   	echo $_FILES['filename']['filesize'] . "<br />";
						   	echo $_FILES['filename']['error'] . "<br />";
							$realFileName = $_FILES['filename']['name'];
							$imgname = rand(1, 9999)."-".$_FILES['filename']['name'];
							copy ($_FILES['filename']['tmp_name'], "keys/".$imgname.$_FILES['filename']['name']) or die ("Could not copy key file." . $_FILES['filename']['error']); 
							$nameofFile = $fileran.$_FILES['profile']['name'];

							$statment ="INSERT into `servers` (id, name, keyfile, password, enabled) VALUES('null', '" . $nameofFile . "', '" . strip_tags($serverinfo['file']) . "', '" . strip_tags($serverinfo['pass']) . "', '" . strip_tags($serverinfo['enabled']) . "')";
							mysql_query($statment) or die (mysql_error());

					}
						   
					?>
					<p>

						<form method="POST" action="?action=addserver" id="addserver"  onsubmit="return checkform(this);">
						<label for="servername">Server Name: </label><input type="text" name="servername" size="16" /><br />
						<label for="filename">File Name: </label><input type="file" name="filename" id="filename" /><br />
						<label for="serverpassword">Server Password: </label><input type="password" name="serverpassword" size="16" /><br />
						<label for="serverenabled">Server Enabled: </label><input type="checkbox" name="serverenabled"><br />
						<div align="center">
						<p><input type="submit" value="Add Server" id="addserver" name="addserver" /></p>
						</div>
						</form>
						</p>

					<?php
					break;
				}

 

This always comes up with the error, There was an erropr uploading the key file.

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.