Mohammad Alipour
Mohammad Alipour

Reputation: 323

Bootstrap form does not send file name

I have wrote a form in bannervipsites.php :

<form role="form" action="index.php" method ="post">
   <div class="form-group">
      <label>نام بنر :</label>
      <input class="form-control" name="sname" placeholder="نام فارسی یا لاتین بنر">
   </div>
   <div class="form-group">
      <label>URL : </label>
      <input class="form-control" name="surl" placeholder="http://">
   </div>
   <div class="form-group">
      <label>Upload banner :</label>
      <input type="file" name='upfile' id='upfile' class="filestyle" data-buttonName="btn-primary" data-buttonBefore="true" data-icon="false" >
      <input type='hidden' name='bform' value='file'>
      <input type='hidden' name='MAX_FILE_SIZE' value='100720'>
   </div>
   <?php
      if ($acctype != 1) {
      ?>
   <div class="form-group">                                             
      <label>حداکثر بازدید در ساعت : (عدد 0 یعنی نامحدود)</label>
      <input class="form-control" name="scph" placeholder="سقف بازدید در ساعت از چه عددی  فراتر نرود؟">
   </div>
   <?php
      }
      ?>
   <div class="form-group">
      <label>روی مربع کلیک کنید : </label>
      <div class="g-recaptcha"></div>
   </div>
   <input type="hidden" name="fform" value="bannervip">
   <input type="hidden" name="sid" value="0">
   <input id="submit" name="submit" value="اضافه کردن" class="btn btn-success" type="submit">
   <button type="button" class="btn btn-default" data-dismiss="modal">بستن</button>
</form>

and then post it to index.php but upfile (the name of uploaded file) does not send. I can not get

echo $_FILES['upfile']['tmp_name'];

in index.php what is the problem? it's very odd for me. it was working in last template .(index.php is ok i'm sure) what is wrong with bootstrap form

Upvotes: 0

Views: 73

Answers (1)

Add

enctype= "multipart/form-data"

to your form.

Upvotes: 1

Related Questions