Tutoriel PHP : upload et envoie de fichier vers le serveur et insertion de données dans Mysql
CREATE TABLE `paper` (
`id` int(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
`author` varchar(50) NOT NULL,
`field` varchar(50) NOT NULL,
`file_name` varchar(50) NOT NULL,
`file_type` varchar(10) NOT NULL,
`file_size` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
<html>
<head>
<title>Submit a Paper</title>
<link href="style.css" rel="stylesheet" type="text/css"></link>
</head>
<body>
<h1>Submit a Paper</h1>
<form action="submit.php" enctype="multipart/form-data" method="post">
<label for="author_name">Author Name:</label>
<input id="author_name" name="author_name" required="" type="text" /><br /><br />
<label for="field_of_research">Field of Research:</label>
<input id="field_of_research" name="field_of_research" required="" type="text" /><br /><br />
<label for="paper_file">Choose a File:</label>
<input id="paper_file" name="paper_file" required="" type="file" /><br /><br />
<input type="submit" value="Submit" />
</form>
</body>
</html>
form {
max-width: 500px;
margin: 0 auto;
}
label {
display: block;
font-weight: bold;
margin-bottom: 5px;
}
input[type="text"], input[type="file"] {
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
margin-bottom: 10px;
width: 100%;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border-radius: 5px;
border: none;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
h1{
position : relative;
left: 45%;
}
Commentaires
Enregistrer un commentaire
Your comment will be reviewed by moderators