jquery PHP file upload causes browser memory usage to skyrocket -


i have jquery code:

$('input[type=file]').on('change', uploadfiles);   function uploadfiles(event) {     var data = new formdata();       var files = event.target.files;          for(var = 0;i<files.length;i++){         data.append("file_"+i, files[i]);     }        data.append('dir_name',current_directory);     apicall('upload.php','post',data,fileuploaded);  } 

then in php file:

<?php $data = array(); $allfiles = scandir($_request['dir_name']); if(isset($_files)) {       $error = false;     $uploaddir = $_request['dir_name'];     foreach($_files $file)     {         echo $file['error'];         echo $file['tmp_name'];         $new_name = $file['name'];         move_uploaded_file($file['tmp_name'], $uploaddir .'/'.$file['name']);     } } else {     //some code here } echo json_encode($error); ?> 

now works , everything, can upload file , multiple files @ time too. causes memory firefox uses skyrocket , never come down again. proportional file upload think, way way bigger. read in manual move_uploaded_file() deletes temporary file, can't problem. thing helps close firefox , open again. can please tell me why happens , how make stop?

if matters, using xampp test out on localhost.

this not happen in chrome.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -