PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sat Apr 29, 2017 10:14 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Feb 20, 2017 3:58 pm 
Offline
Forum Newbie

Joined: Mon Feb 20, 2017 3:54 pm
Posts: 1
sorry for english , in my project the user can upload from 1 to 14 file (file from 2mb to 50mb)with ajax ,this is the simple php code :

Syntax: [ Download ] [ Hide ]

//percorso della cartella dove mettere i file caricati dagli utenti
$uploaddir = $_SERVER['DOCUMENT_ROOT'].'/uploaded/';



############################################
#              FILE 1                      #
############################################

//solo per il file 1
if(!isset( $_FILES['stl1']['tmp_name']) OR $_FILES['stl1']   ['tmp_name']==''){
   $user->set_errors('File 1 non selezionato!!!');

}

//se presente il file 1
if(isset( $_FILES['stl1']['tmp_name']) AND $_FILES['stl1']['tmp_name']!=''){
   //se non c'è l'id del materiale
   if(!isset($_POST['materiale1'])){
      $user->set_errors('Manca il materiale!!!');

   }

   else{

      //Recupero il percorso temporaneo del file
      $userfile_tmp = $_FILES['stl1']['tmp_name'];

      //recupero il nome originale del file caricato
      $userfile_name = $_FILES['stl1']['name'];



  //copio il file dalla sua posizione temporanea alla mia cartella upload
  if (move_uploaded_file($userfile_tmp, $uploaddir . $nome_dropbox)) {
    //Se l'operazione è andata a buon fine...
       //inserisco nel db il file
                    if($user->insert_lavorazioni($_POST['materiale1'],
                                 $_POST['numero_scheda'],
                                 $_POST['colore'],
                                 $userfile_name)){

                                 $user->debug[]='<br>Lavorazione inserita nel db';



                    }else{
                          $user->set_errors('Problemi nell\'inserimento lavorazione nel db');

                    }


  }else{
    //Se l'operazione è fallta...
    $user->set_errors('Upload NON valido!');
  }







   }

}

 



For every file i called another script equal to this .When more user upload file simultaneously the server memory go to overload and other ajax request for example populate dinamically select input dont work .

How can i reduce memory usage ?

this is my server features:
Cores: 2 x 2.1 ghz - Physical Memory: 1 Gbyte - Virtual Memory: 8 Gbyte - HD: SSD.12 Core Server Minimum - 64 GB RAM Server Minimum

memory_limit is set at 768Mb


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Exabot [Bot] and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group