sumana's avatar

cannot upload large size file on server

hi..i am new in laraval. I am working on my first project. in that i cannot upload larger files(above 500mb) on server. it is hang on 3% - 6% .but can upload in my localhost. pls help me.

fileupload.blade.php

            <input type="file" class="form-control" placeholder="Detail" name="upfile" id="file1">
            
        </div>
        <div class="form-group">
             <button type="submit" class="btn btn-info btn-fill" name="upload1" id="upload1">Upload</button>
        </div>

script code

$(document).ready(function(){
$('#form2').ajaxForm({
  beforeSend:function(){
    $('.progress1').removeClass();
    $('#success1').empty();

  },
  uploadProgress:function(event, position, total, percentComplete)
  {
    $('.progress-bar1').text(percentComplete + '%');
    $('.progress-bar1').css('width', percentComplete + '%');
  },
  success:function(data)
  {
    if(data.errors)
    {
      $('.progress-bar1').text('0%');
      $('.progress-bar1').css('width', '0%');
      $('#success1').html('<span class="text-danger"><b>'+data.errors+'</b></span>');
       $('.progress1').addClass('hide');
    }
    if(data.success)
    {
      $('.progress-bar1').text('Uploaded successfully');
      $('.progress-bar1').css('width', '100%');
      $('#success1').html('<span class="text-success"><b>'+data.success+'</b></span><br /><br />');
      //$('#success').append(data.image);
      $('#hdnuploadall').attr('value',data.filename );
      $('#uploadallfile').attr('value',data.filename );
      $('.progress1').addClass('hide');
    }
  }
});

});

my controller code:

$rules = array( 'upfile' =>'required' );

$error = Validator::make($request->all(), $rules);

 if($error->fails())
 {
  return response()->json(['errors' => $error->errors()->all()]);
 } 

 $image = $request->file('upfile');

 $new_name = rand() . '.' . $image->getClientOriginalExtension();
 $image->move('uploads/resources', $new_name);

 $output = array(
     'success' => 'uploaded successfully',
   
     'filename' => $new_name
    );

    return response()->json($output);

server php.ini file configuration:

allow_url_fopen = Off allow_url_include = Off display_errors = On enable_dl = Off file_uploads = On max_execution_time = 248 max_input_time = 7200 max_input_vars = 4096 memory_limit = 5000M post_max_size = 4098M session.gc_maxlifetime = 7200 session.save_path = "/var/cpanel/php/sessions/ea-php72" upload_max_filesize = 4096M zlib.output_compression = Off

please help me. Thanks in advance.

0 likes
2 replies
Sinnbeck's avatar

If you create a phpinfo.php file with the following

<?
phpinfo(); 

Does calling this file on the server give the same values?

sumana's avatar

Yes. it gives the same values.

Please or to participate in this conversation.