php - $_FILES empty after multiple files upload -
i trying upload multiple files mysql database.
everything works fine untill surpass around 7 8 mb. lot of internet reactions should have php.ini settings, i've tried check them. php version 5.2.17 code below:
<?php include_once "mysql.php"; ?> <body> <form action="" method="post" enctype="multipart/form-data"> <label for="album">album</label> <input type="text" id="album" name="album" /><br> <label for="fotos">foto's</label> <input type="file" id="files" name="files[]" multiple accept="image/*" /> <input type="submit" value="upload" /> </form> <?php echo "<br>upload_max_filesize: ".ini_get('upload_max_filesize'); echo "<br>post_max_size: ".ini_get('post_max_size'); echo "<br>memory_limit: ".ini_get('memory_limit'); echo "<br>realpath_cache_size: ".ini_get('realpath_cache_size'); echo "<br>realpath_cache_ttl: ".ini_get('realpath_cache_ttl'); $valid_formats = array("jpg", "png", "gif", "bmp"); $max_file_size = 6291456; //6mb $count = 0; $mysql = new mysql; //own class $mysql->db_connect(); if(isset($_post) , $_server['request_method'] == "post"){ // loop $_files exeicute files foreach ($_files['files']['name'] $index => $name) { echo $index; $fotos[$index]['album'] = $_post['album']; $fotos[$index]['name'] = $_files['files']['name'][$index]; $fotos[$index]['type'] = $_files['files']['type'][$index]; $fotos[$index]['tmp_name'] = $_files['files']['tmp_name'][$index]; $fotos[$index]['error'] = $_files['files']['error'][$index]; $fotos[$index]['size'] = intval($_files['files']['size'][$index]); } foreach ($fotos $foto) { if($foto['error'] == 0) { if($foto['size'] < $max_file_size) { $fp = fopen($foto['tmp_name'], 'r'); $content = fread($fp, filesize($foto['tmp_name'])); $content = addslashes($content); fclose($fp); $mysql->qry("insert albums (`album`, `type`, `name`, `img` ) values ('".$foto['album']."', '".$foto['type']."', '".$foto['name']."', '".$content."')"); } else { echo "file big<br>"; echo "file: ".$foto['size']." < max: ".$max_file_size."<br>"; } } else { echo "errorcode: ".$fotos['error'] . "<br>"; } } $mysql->close(); echo "<pre>"; print_r($fotos); echo "</pre>"; } ?> </body>
my output of ini_get is
- upload_max_filesize: 128m
- post_max_size: 128m
- memory_limit: 256m
- realpath_cache_size: 4m
- realpath_cache_ttl: 120
Comments
Post a Comment