i need file upload form html.
I've been used only one file upload in a form or static muliple input type files in a form.
I need dynamic multiple file upload from a form.
I. Get a Sample
II.Run a Sample Code
III. Make It Your Own.
IV. Make It Shippable.
I. Get a Sample
I use readmine. The file upload routine is first view one file upload input field,
second press "order file add" button then file upload input is appear. this is what I want.
i can understand upload source. but i have to guess that how server works.
here is redmine source code javascript.
======================================================================
application.js
======================================================================
var fileFieldCount = 1;
function addFileField() {
var fields = $('attachments_fields');
if (fields.childElements().length >= 10) return false;
fileFieldCount++;
var s = new Element('span');
s.update(fields.down('span').innerHTML);
s.down('input.file').name = "attachments[" + fileFieldCount + "][file]";
s.down('input.description').name = "attachments[" + fileFieldCount + "][description]";
fields.appendChild(s);
}
function removeFileField(el) {
var fields = $('attachments_fields');
var s = Element.up(el, 'span');
if (fields.childElements().length > 1) {
s.remove();
} else {
s.update(s.innerHTML);
}
}
function checkFileSize(el, maxSize, message) {
var files = el.files;
if (files) {
for (var i=0; i<files.length; i++) {
if (files[i].size > maxSize) {
alert(message);
el.value = "";
}
}
}
}
=========================================================================
Now it's enough make a sample upload form.
======================================================================uploadForm.html
======================================================================
======================================================================
uploadProc.php
=========================================================================<?
print_r($_FILES);
?>
댓글 없음:
댓글 쓰기