<input type="file" name="pic[]" accept="image/*" /><input type="file" name="pic[]" accept="image/*" /><input type="file" name="pic[]" accept="image/*" />
// Count # of uploaded files in array$total = count($_FILES['pic']['name']);// Loop through each filefor($i=0; $i<$total; $i++) { //Get the temp file path $tmpFilePath = $_FILES['pic']['tmp_name'][$i]; //Make sure we have a filepath if ($tmpFilePath != ""){ //Setup our new file path $newFilePath = "./uploadFiles/" . $_FILES['pic']['name'][$i]; //Upload the file into the temp dir if(move_uploaded_file($tmpFilePath, $newFilePath)) { //success }else{ //fail } }}
bamossza
พลังงานการช่วยเหลือ
( Level 3 )
คะแนนขอบคุณจากสมาชิก
( 16 )
ตอบกระทู้ ( 112 )
เขียนบทความ ( 28 )
ส่วน php ก็ใช้ loop เข้าช่วยครับ
ลองดูครับไม่ยาก ^___^