HTML5 �� multiple ������ PHP �̎�M

HTML5 �Œlj����ꂽ multiple �������g���� 1�‚� input �^�O���� �����̃t�@�C�����A�b�v���[�h���邱�Ƃ��ł��܂��B

<input type="file" ... multiple>

�����ځi����Firefox�j�́A multiple ������t���Ȃ��ꍇ�Ɠ����ł��B

WRITE_0801_01

�t�@�C����I������Ƃ��� �����I���ł��܂��B

WRITE_0801_02

�t�@�C���̑I����A Firefox �ł� �I�������t�@�C�������\������܂��B

WRITE_0801_03

�t�@�C���� 1 �‚����I�����Ȃ��ꍇ�� multiple ������t���Ȃ��ꍇ�Ɠ����� �I�������t�@�C�������\������܂��B

WRITE_0801_04

���� �T�[�o���� PHP �� multiple �������g���� input �^�O���� �����̃t�@�C�����󂯂Ă݂܂��B

�܂� �_���ȃp�^�[���ł����A <input> �^�O�� test_files �Ƃ��� ���O��t���܂��B

<input type="file" name="test_files" ... multiple>

"1.txt" �� "2.txt" ��I�����đ��M�isubmit�j���܂��B

PHP ���� $_FILES �̓��e���o�͂��Ă݂܂��B

var_dump($_FILES['test_files']);
array(1) {
  ["test_files"]=> array(5) {
    ["name"]=> string(5) "2.txt"
    ["type"]=> string(10) "text/plain"
    ["tmp_name"]=> string(14) "/tmp/php2zriSB"
    ["error"]=> int(0)
    ["size"]=> int(1610229)
  }
}

�t�@�C���𕡐����M�����̂� "2.txt" ��������܂���B

����� PHP �� 1�‚̖��O�ŕ����̒l�𑗂�ꍇ input �^�O�̖��O��z��ɂ��Ȃ��ƂȂ�Ȃ�����ł��B �i�ʏ�̃e�L�X�g�{�b�N�X�⃉�W�I�{�^���Ȃǂł����l�ł��j

���O�� [] ��t���Ĕz��̎w��ɂ��܂��B

<input type="file" name="test_files[]" ... multiple>
array(1) {
  ["test_files"]=> array(5) {
    ["name"]=> array(2) {
      [0]=> string(5) "1.txt"
      [1]=> string(5) "2.txt"
    }
    ["type"]=> array(2) {
      [0]=> string(10) "plain/text"
      [1]=> string(10) "plain/text"
    }
    ["tmp_name"]=> array(2) {
      [0]=> string(14) "/tmp/php3MKNhg"
      [1]=> string(14) "/tmp/phpyJ9uB0"
    }
    ["error"]=> array(2) {
      [0]=> int(0)
      [1]=> int(0)
    }
    ["size"]=> array(2) {
      [0]=> int(310934)
      [1]=> int(1610229)
    }
  }
}

���x�́A��̂悤�ȓ��e�Ŏ󂯎��܂����B

�Ή����Ă��Ȃ��u���E�U�ł��A���܂łƓ������삪�ł���̂��ǂ��ł��ˁB

Google �T�C�g������

Amazon�A�\�V�G�C�g