+ 1
keep having this error undefined error: file ......
<?php if(isset($_POST['submit1'])) { $tm = md5 (time()); $fnm = $_FILES["file"]["name"]; $dst = "../LMS for OCC/librarian/books_images/".$tm.$fnm; $dst1 = "books_images/".$tm.$fnm; move_uploaded_file($_FILES["file"]["tmp_name"],$dst); mysqli_query($conn,"insert into add_book values('','$_POST[bname]','$dst','$_POST[aname]','$_POST[pname]','$_POST[pdate]','$_POST[price]','$_POST[qty]','$_POST[aqty]','$_SESSION[librarian]')"); ?> <script type="text/javascript"> alert("books insert successfully"); </script> <?php } ?>
2 Respuestas
+ 2
Your code tried to refer to an element that doesn't exist in $_FILES array, I don't know which line because your error message didn't clearly specify it.
(Edit) I think it's in the line where you move uploaded file.
Dump $_FILES as follows to see what keys and values it contain, and see which one you actually want.
var_dump($_FILES);
Hth, cmiiw
0
notice : undefined index : file in