Popular Posts

Oct 16, 2011

Upload files in PHP


You can easily Upload files in php.

$path_parts3 = pathinfo($_FILES['payment_document']['name']);
 mkdir("../documents/payment/payment_document/$pa_id");
 move_uploaded_file($_FILES['payment_document']['tmp_name'],
   "../documents/payment/payment_document/$pa_id/".$_FILES['payment_document']['name']);
 $payment_document = $_FILES['payment_document']['name'];

<form name="lbpfrm" action="" method="post" enctype="multipart/form-data">
<input type="file" name="payment_document" />
</form>

Upload multiple file

//echo sizeof($FILES['ulis_branch_info_doc'])." OOO ";
 for($i=0;$i<count($_FILES['ulis_branch_info_doc']['name']);$i++) {
     if($_FILES['ulis_branch_info_doc']['name'][$i]!='') {
   
 $path_parts = pathinfo($_FILES['ulis_branch_info_doc']['name'][$i]);
 mkdir("../documents/ulis/branch_info/$ulis_id");
 move_uploaded_file($_FILES['ulis_branch_info_doc']['tmp_name'][$i],
         "../documents/ulis/branch_info/$ulis_id/".$i.$_FILES['ulis_branch_info_doc']['name'][$i]);

      }
 }

No comments:

Post a Comment