Welcome Guest, Not a member yet? Register   Sign In
Intercepting Large File Uploads
#1

[eluser]cassy[/eluser]
In my PHP.INI file, I have the following:

post_max_size = 21M
upload_max_filesize = 20M

When I upload a file that’s bigger than 20MB, PHP throws an error and dies! Normal I guess.

However, is there a way that I can intercept the error before PHP dies, allowing me to show my own message?
#2

[eluser]marcopolo[/eluser]
Before to call the upload method you can declare the $config for initialize

Code:
$config['max_size'] = '2048'; // 2Mb

Then after calling method for upload you can check for errors and handle it
Code:
$this->load->library('upload', $config);

  if ( ! $this->upload->do_upload())
  {
   $error = array('error' => $this->upload->display_errors());
#3

[eluser]cassy[/eluser]
Forgive me, I am new to PHP.

Where exactly would I put that?

I'm also not using CI directly for the upload. I wanted to do an AJAX feedback thing, with a nice progress indicator and so I found the Upload Progress extension for PHP

http://blog.liip.ch/archive/tag/uploadprogress/

Could someone tell me more about better integrating the Upload Progress extension with CI?
#4

[eluser]cassy[/eluser]
Does anyone have a solution for me?




Theme © iAndrew 2016 - Forum software by © MyBB