مرحبا،
أود أن أرفع ملفين باستخدام php وإضافة أسماء الملفين إلى قاعدة البيانات لكن في صف واحد،وذلك باستعمال هذا السكربت : http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/
لكن قمت بالتعديل على ملف php حتى أصبح بهذا الشكل :
if(isset($_FILES['up2'])){
$im = uniqid ('',true)."_".$_FILES['up2']['name'];
$vi = uniqid ('',true)."_".$_FILES['upl']['name'];
$up_img = move_uploaded_file($_FILES['up2']['tmp_name'], 'assets/'.$im);
$up_vid = move_uploaded_file($_FILES['upl']['tmp_name'], 'uploads/'.$vi);
$db->query("INSERT INTO cm_videos (id,title,img,video,category) VALUES (NULL,'$ti2','$im','$vi','$ca2')");
}
فورم الرفع :
<form id="upload" method="post" action="" enctype="multipart/form-data">
<div id="drop">
Drop Here
<a>صورة</a>
<input type="file" name="up2" id="up2" multiple />
<input type="file" name="upl" id="upl" multiple />
</div>
<ul>
<!-- The file uploads will be shown here -->
</ul>
</form>
وبهذا يتم فقط رفع الملف "up2" وعندما أقوم بتغييره في السطر الأول إلى "upl" يتم رفع هذا الأخير، وان قمت بالتحقق من الملفين معا لا يتم رفع أي منهما !
وعندما أستعمل حلقات التكرار يتم إدخال كل ملف في صف منفصل عن الآخر :
هل من حل ؟