Howdy - I'm having issues uploading files through a submission form in PHP. Below is my code. I specifically marked the lines I believe are causing the problems, as I am getting the follow errors:
Notice: Array to string conversion and
Warning: move_uploaded_file() expects parameter 1 to be string, array given
Any help would be much appreciated!
<?php
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$facebook = $_POST['facebook'];
$linkedin = $_POST['linkedin'];
$twitter = $_POST['twitter'];
$yourStory = $_POST['yourStory'];
$file = $_FILES['file']['name'];
$file_loc = $_FILES['file']['tmp_name'];
$file_size = $_FILES['file']['size'];
$file_type = $_FILES['file']['type'];
$folder="uploads/";
move_uploaded_file($file_loc, $folder.$file); //ISSUE HERE
$connection = mysqli_connect('localhost','root','','cms');
$query = "INSERT INTO report(name, email, phone, facebook, linkedin, twitter, yourstory, file, type, size)";
$query .= "VALUES ('$name','$email','$phone','$facebook','$linkedin','$twitter','$yourStory','$file','$file_type','$file_size')";//ANOTHER ISSUE HERE
mysqli_query($connection, $query);
}
?>