-1
我希望我可以給你一個鏈接,但他們指責這一切對我所以在這裏最後一次是javascript代碼:
function Multifile(list){
this.id=0;
this.list=list;
this.createNew=function(element){
element.name='file[]';
element.multiFile=this;
element.onchange=function(){
var newElement=document.createElement('input');
newElement.type='file';
this.parentNode.insertBefore(newElement,this);
this.multiFile.createNew(newElement);
this.multiFile.addList(this);
this.style.position='absolute';
this.style.left='-1000px';
};
};
this.addList=function(element){
var newRow=document.createElement('div');
var newButton=document.createElement('input');
newButton.type='button';
newButton.value='delete';
newRow.element=element;
newButton.onclick=function(){
this.parentNode.element.parentNode.removeChild(this.parentNode.element);
this.parentNode.parentNode.removeChild(this.parentNode);
return false; //safari thing
};
newRow.innerHTML=element.value;
newRow.appendChild(newButton);
this.list.appendChild(newRow);
};
};
var multifile=new Multifile(document.getElementById('fList'));
multifile.createNew(document.getElementById('file'));
這是HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<form id="upload" action="uploadPost.php" method="post" enctype="multipart/formdata">
<input id="file" type="file"/>
<input type="submit" value="upload"/>
</form>
<div id="fList">
</div>
<script type="text/javascript" src="javascriptcode.js">
</script>
</body>
</html>
我的PHP腳本: '; echo $ _FILES ['file'] ['name'] 1; ? >
,並在這裏結束我的問題:
選擇2檔它從來沒有要打印數組成員後,[0] 除了當我刪除第二個文件時,它給它的1到數組成員值最初有[0]
HERE數組成員值的第一個元素是要看到什麼是我的故事
這是什麼'的var_dump($ _ FILES)'給? – 2011-03-08 16:47:25
你可以顯示'var_dump($ _ FILES)的結果;'在上傳腳本中運行嗎? – 2011-03-08 16:47:28
array(1){[「file」] => array(5){[「name」] => array(3){[0] => string(0)「」[1] => string(6) 「shadow」[2] => string(5)「group」} [「type」] => array(3){[0] => string(0)「」[1] => string(24)/octet-stream「[2] => string(24)」application/octet-stream「} [」tmp_name「] => array(3){[0] => string(0)」「[1] => string(14)「/ tmp/php3NXUyj」[2] => string(14)「/ tmp/phpbBVhSj」} [「error」] => array(3){[0] => int(4)[1] => int(0)[2] => int(0)} [「size」] => array(3){[0] => int(0)[1] => int > int(916)}}} shadow – daniel 2011-03-08 22:41:56