please could someone check this for me? I have followed the info that I found on here and still I cant get it to work. My host says that this should now be possible as the permissions were previously blocked, and are not exactly the most helpful. Thanks, I can always rely on StackOverflow to help out when needed. :)
<?PHP
IF(isset($_POST['submit'])){
$caption = $_POST['caption'];
$file = $_FILES['file']['name'];
$target="images/slider";
if(is_uploaded_file($_FILES['file']['tmp_name'])){
move_uploaded_file($_FILES['file']['tmp_name'], 'images/slider/'.$_FILES['file']['name']) or die ('cannot upload');
require_once('../includes/dbupcombo.php');
$query = "INSERT INTO PremierSlider (caption, image) values ('$caption','$file')";
mysql_query($query) or die(mysql_error());
}
header("location: http://www.premierdancecentre.com/admin/index.php#mod_image");
}
?>
The script runs onclick and returns 'cannot upload'. Any help as to why would be greatly appreciated as i'm still trying to get good at PHP. Cheers guys
First of all please check that you are using a proper form tag
<form action="upload_file.php" method="post" enctype="multipart/form-data">
check that you have
enctype="multipart/form-data"
on form.in
upload_file.php
check that you are really getting the file by doing
var_dump($_FILES)
if yes, then you can use your
move_uploaded_file