php - $_FILES array showing up empty -
i have been trying find thread help, , have tried find fix this.
i have page uploads file, can type, , works. decided use same functionality on page, $_files array empty.
form:
<form method="post" class="mainform" enctype="multipart/form-data"> <fieldset> <div class="widget first"> <div class="rowelem"> <label for="file">upload profile picture</label> <div class="formright"> <input type="file" id="profilepicture" name="profilepicture" /> <button formaction="profile_pic.php" class="greyishbtn">upload</button> </div> </div> </fieldset> </form> php:
$name_first = "john"; $name_last = "doe"; $folder_name = $name_last . "-" . $name_first . "-id-" . $id . "/"; $dirname = "profile/" . $folder_name; if(!is_dir($dirname)){ mkdir($dirname); } $dirname = $dirname . $_files['file']['name']; if(move_uploaded_file($_files['file']['tmp_name'], $dirname)){ header("location:profile.php"); } else{ echo $dirname; } ?> the echo $dirname shows folder no file name.
well, input file called name='profilepicture'
try:
$dirname = $dirname . $_files['profilepicture']['name']; and
if(move_uploaded_file($_files['profilepicture']['tmp_name'], $dirname)){ header("location:profile.php"); }
Comments
Post a Comment