i got error msg as follow :
Warning: move_uploaded_file() expects parameter 1 to be string, array given in E:\wamp\www\myweb\admin\upload.php on line 21

can anybody show e what's wrong with my script? pls

<?php
$locate = $_FILES['fupload']['tmp_name'];
$name   = $_FILES['fupload']['name'];
$size = $_FILES['fupload']['size'];

$direktori = "../gallery/$name";

// if file exist
if (file_exists($direktori)){
  echo "Upload Failed !!! <br>";
}
else{
  move_uploaded_file($locate,"$direktori"); // line 21


  $input="INSERT INTO tb_gallery(gal_name,gal_size)
          VALUES('$name','$size')";
  mysql_query($input);
}

?>

    Best way is to find out by checking what is inside the parameter the parser complains about. It works every time! Understanding why it is a certain way may or may not always be obvious, but this debug approach is a decent way of getting there

    var_dump($locate);
    

      @ : thanks for your tips.. it's very useful..

      @ : you're the best .. yes I'm using form which previously is a multiple upload form and I forgot to change the input name from fupload[] to fupload 😃

      thank you very much.

        Write a Reply...