<form method="post" action="" enctype="multypart/form-data">
<div class="row" style="margin-left:70px">
<p>Carousel Number</p>
<select name="carousel_num">
<option value="1">1</option>
<option value="2">2</option>
<option value="2">3</option>
</select>
</div>
<input type="file" name="pic">
<input type="submit" name="submit" class="btn btn-primary" value="Upload">
</form>
<?php
if(isset($_POST['submit'])){
$carousel_num = $_POST["carousel_num"];
$tmpname = $_FILES["pic"]['tmp_name'];
$filename = $_FILES["pic"]['name'];
$file_ext_arr = explode(".",$filename);
$file_name = $file_ext_arr[0];
$ext = end($file_ext_arr);
if($ext == "jpg" || $ext == "png" || $ext == "jpeg" || $ext == "gif"){
move_uploaded_file("Carousel_$carousel_num","./upload/".$ext);
echo "<script>history.go(-1);</script>";
}else{
echo "<script>alert(\"only 'jpg, png, jpeg, gif' file is permitted.\");history.back(-1);</script>";
}
}
?>
Hi guys, This code make an error
Notice: Undefined index: pic in /Applications/MAMP/htdocs/astral/special.php on line 49
like this. I think, there is no spelling mistake. I don't know what Should I do to make it work.
Please help me!!