开发者

Multi file upload with description to each file

开发者 https://www.devze.com 2023-01-30 11:52 出处:网络
<input type=\"file\" name=\"file[]\" /> <input type=\"text\" name=\"description[]\" /> <input type=\"file\" name=\"file[]\" />

<input type="file" name="file[]" />
<input type="text" name="description[]" />

<input type="file" name="file[]" />
<input type="text" name="description[]" />

and should the name of them be the same name bacause actully i have one is appear to the end user and the others it clones when the end user clike on " + button" so the others are Cloned with the same name and every thing

so how can I get the info from the form like this: File#1 - description File#2 - description File#2 - description

also i don't have just the description below each file i have select menu and and other.

and i want to get all these info for each file

I have this for input file:

while(list($key,$value) = each($_FI开发者_如何学CLES[image][name])){

if(!empty($value)){
$filename = $value;

// Result here

}}

I asked before HERE but the solution should i change the name items[0][type] items1[type] like this and as I said earlier I Should not change the name

this is for other fields:

<select name="items[0][type]"> 
<input name="items[0][color]">  
<select name="items[1][type]"> 
<input name="items[1][color]"> 

foreach ($_POST['items'] as $item) { 
    $type = $item['type']; 
    $color = $item['color']; 
}

but as i said this not helpfull because the name not unified

I want to grab all the information from the form for each file

its so important to me to know how this work can anybody help me

thank you


for ($counter=0; $counter<count($_POST['description']); $counter++) 
{
    if(isset($_FILES['file']['name'][$counter]) && $_FILES['file']['name'][$counter])
    {
       $filename = $_FILES['file']['name'][$counter]; 
       $description = $_POST['description'][$counter]; 
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消