Reputation: 878
I have the following PHP/ HTML code:
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$file_name = "../images/".$_FILES["file"]["name"];}
echo $file_name;
?>
<form name="updateArticle" method="post">
<div class="custom_file_upload">
<input type="text" class="file" name="file_info" id="file_info" disabled="disabled" value="<?php echo $image_name;?>">
<div class="file_upload">
<input type="file" id="file_upload" name="file" onchange="name_change()" id="file">
</div>
</div>
The problem here is that I can't get the value of $_FILES["file"]["name"]
Why and how can I fix it?
Upvotes: 1
Views: 13283
Reputation: 13535
your form hasn't specified the multipart/form-data
for file uploads
change your form and set the proper enctype
<form name="updateArticle" method="post" enctype='multipart/form-data'>
Upvotes: 5