0

I have an html file for user to select two files and a button for uploading

<form name="frm" id ="frm" method="post" action="" enctype="multipart/form-data">


Upload FILE1 : <input type="file" name="f1" id="alett" id="alett" accept="application/pdf">

Upload FILE2 : <input type="file" name="f2" id="photo" accept="application/pdf">

<button name="btnsave" type="submit">Save</Button>

and my php code is

<?php
    if(isset($_REQUEST['btnsave'])){
        $a = $_FILES["f1"];
        print "<pre>";
        print_r($a);
        print "</pre>";

        $a = $_FILES["f2"];
        print "<pre>";
        print_r($a);
        print "</pre>";
    }
?>

When i upload only one file than it works fine, but when i select both file then browser only processes and nothing happen anything else.

I don't know what is problem.

i checked max_file_uploads and upload_max_filesize but it is ok.

please anyone help me.

1 Answers1

0

Use below code

<form action="file-upload.php" method="post" enctype="multipart/form-data">
  Send these files:<br />
  <input name="userfile[]" type="file" /><br />
  <input name="userfile[]" type="file" /><br />
  <input type="submit" value="Send files" />
</form>

post variable like below Array ( [name] => Array ( [0] => foo.txt [1] => bar.txt )

[type] => Array
    (
        [0] => text/plain
        [1] => text/plain
    )

[tmp_name] => Array
    (
        [0] => /tmp/phpYzdqkD
        [1] => /tmp/phpeEwEWG
    )

[error] => Array
    (
        [0] => 0
        [1] => 0
    )

[size] => Array
    (
        [0] => 123
        [1] => 456
    )

)

for more info http://php.net/manual/en/features.file-upload.multiple.php

Anudeep Sharma
  • 141
  • 1
  • 4