forms - PHP - Multiple file upload stuck at 20 items -
i'm trying setup multiple image uploader , whenever try , upload more 20 files, first 20 files uploaded.
before continue, id max_file_uploads in php.ini setup 400, other answers similar questions not seem resolve problem.
my full code below, please note know using mysql_query, local testing purposes.
-
php
if(isset($_post['upload'])){ include("simpleimage.php"); echo count($_files['file']['name']); for($i=0; $i<count($_files['file']['name']); $i++) { $allowedexts = array("gif", "jpeg", "jpg", "png", "jpg"); $extension = end(explode(".", $_files["file"]["name"][$i])); date_default_timezone_set('europe/london'); $date = date_create(); if ((($_files["file"]["type"][$i] == "image/gif") || ($_files["file"]["type"][$i] == "image/jpeg") || ($_files["file"]["type"][$i] == "image/jpg") || ($_files["file"]["type"][$i] == "image/png")) && ($_files["file"]["size"][$i] < 10485760) && in_array($extension, $allowedexts)){ $name = date_timestamp_get($date) . "_" . mt_rand() . "." . $extension; if ($_files["file"]["error"][$key] > 0){ $messages[] = "return code: " . $_files["file"]["error"][$i] . "<br>"; }else{ $imagethumbtruelocation = "../../gallery/thumb/" . $name; $imagelargetruelocation = "../../gallery/photos/" . $name; $imagethumb = new simpleimage(); $imagethumb->load($_files["file"]["tmp_name"][$i]); $imagethumb->resizetowidth(230); $imagethumb->save($imagethumbtruelocation); $imagethumblocation = "thumb/" . $name; $imagelarge = new simpleimage(); $imagelarge->load($_files["file"]["tmp_name"][$i]); $imagelarge->resizetowidth(800); $imagelarge->save($imagelargetruelocation); $imagelargelocation = "photos/" . $name; $queryresult = mysql_query("insert gallery (thumbnail, highres) values ('$imagethumblocation', '$imagelargelocation')") or die(mysql_error()); if(!$queryresult) { $messages[] = "failed insert record database."; }else{ $messages[] = "record sucessfully added database."; } } }else{ $messages[] = "invalid file"; } } }
html
<form action="#" method="post" enctype="multipart/form-data"> <input type="file" name="file[]" id="file" multiple> <input type="submit" name="upload" value="upload" /> </form>
i know mentioned max_file_uploads case 400 isnt recognised try 99? reason specific number 20! every time there must limit. have checked apache config there may limit in there well
i fire these off javascript each upload has own thread speak , able work round limit if there any.
Comments
Post a Comment