开发者

multiple file upload script not working in php

im using java script to upload multiple images but some how its no working ...only the first file gets uploaded. javascript works standalone but when i integrate it with my existing code it doesnt. im refering the same php file after submit and then using if($_REQUES开发者_如何学运维T['Submit']). i have tried fixing the number of elements it works....but cant get it working dynamically


Name the inputs with square brackets at the end of their name. If there is no value inside the brackets, they will be put sequentially into an array. If there is a value, that will be used as the key in the array:

HTML:

<input type="hidden" name="inp[]" value="a" />
<input type="hidden" name="inp[]" value="b" />
<input type="hidden" name="inp[]" value="c" />
<input type="hidden" name="inp[foo]" value="bar" />

PHP:

print_r($_POST);
/* 
array(
    0 => 'a',
    1 => 'b',
    2 => 'c',
    'foo' => 'bar'
)
*/

The same should apply to the $_FILES array.


PHP has a max_upload_size and max_post_size If your upload post size exceeds these then uploads often fail. Make sure you have these set real high, I usually set 200M+

use phpinfo() to get what these values are set too

A better option is to have your script upload each file one at a time in the background

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜