Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_POST['upload']))
- {
- $target = $_FILES['image']['name'];
- $target_dir = "image/";
- $target = $target_dir.basename($_FILES['image']['name']);
- $sql = "INSERT INTO uploadimage (image) VALUE ('$target')";
- // This is an if statement to say if the target directory exists then set permissions.
- if (!file_exists($target_dir) )
- {
- mkdir ($target_dir, 0744);
- }
- // This part of the code is to say if the image is uploaded correctly or not and show an error message.
- if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
- {
- echo " Image has been uploaded ";
- }
- else
- {
- echo "Error while uploading";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement