secret
Last active

What's wrong with reading the type?

  • Download Gist
form.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<html>
 
<head>
<title>FORM</title>
</head>
 
<body>
<h2>Registration Form</h2>
<form ENCTYPE="multipart/form-data" method="post" action="insert.php">
 
Name: <input type="text" name="name" maxlength="15" /><br />
Email: <input type="text" name="email" maxlength="30" /><br />
Password: <input type="password" name="password" maxlength="15" /><br />
Confirm Password: <input type="password" name="cpassword" maxlength="15" /><br />
 
<input type="hidden" name="MAX_FILE_SIZE" value="10000">
Choose your picture: <input type="file" name="upload"><p>
<input type="submit" name="submit" value="Register" /><br />
 
<p>
<center><h3><?php include("links.php"); ?></h3></center>
 
</form>
</body>
 
</html>
insert.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php
 
// relevant code snippets
$mypic = $_FILES['upload']['name'];
$temp = $_FILES['upload']['tmp_name'];
$type = $_FILES['upload']['type'];
 
$name = mysql_real_escape_string($_POST["name"]);
$email = mysql_real_escape_string($_POST["email"]);
$pw = mysql_real_escape_string($_POST["password"]);
$cpw = mysql_real_escape_string($_POST["cpassword"]);
 
echo $type."<br />";
 
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.