Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="phpscripts/fileupload/imageupload.php" method="post" enctype="multipart/form-data" id="ImageUploadForm">
- <div class="filetitle"><input type="text" name="filetitle" id="filetitle" placeholder="Title for Image"></div><br>
- <div class="choosefile"><input type="file" name="fileToUpload" id="fileToUpload" accept="image/*"></div>
- <div class="filedescription"><textarea name="filedescription" id="filedescription" placeholder="Short Description about the Image"></textarea></div><br /><br>
- <div class="uploadbutton"><input type="submit" value="Start Upload" name="submit" id="imagesubmit"></div>
- </form>
- <?php
- $server = "localhost";
- $username = "databaseuser";
- $password = "letmein";
- $db = "db_imageupload";
- $connect = @mysql_connect($server, $username, $password);
- ?>
- <?php if ($connect && mysql_select_db($db, $connect)) : ?>
- <?php
- // Add imagestuff to database
- if(isset($_POST['submit'])){
- mysql_query("INSERT INTO imageupload (title, imagepath, description) VALUES('".mysql_real_escape_string($_POST['filetitle'])."','".mysql_real_escape_string($imagename.".".$imageFileType)."','".mysql_real_escape_string($_POST['filedescription'])."')") OR die(mysql_error());
- }
- ?>
- <?php else : ?>
- <h2>Database connection failed!</h2>
- <?php endif; ?>
- Create Table imageupload(
- pk_imageID Integer Primary Key,
- title varchar(100),
- imagepath varchar(45),
- description varchar(300),
- time Integer
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement