Jump to content


Photo
- - - - -

maximum upload size not working on my server

maximum upload size

  • Please log in to reply
12 replies to this topic

#1 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 09 July 2017 - 07:34 PM

Hi,

 

I can't figure out why my video upload page is allowing any size files to be uploaded.  Probably the only thing that might stop a too big fle might be a script timeout.

 

In the upload page we have

 

<input type="hidden" name="MAX_FILE_SIZE" value="{$upload_max_size}" />

 

the setting for $upload_max_size is being passed as I verified this.

 

The php code doesn't kick in with an error on a too big file.

 

My phpinfo shows 

Loaded Configuration File /usr/local/lib/php.ini

 

 

upload_max_filesize 262M

 

 

post_max_size

262M

 

 

Any suggestions anyone?

 

Thanks,

Brian

 



#2 myavsforums

myavsforums

    Junior Member

  • Members
  • PipPip
  • 66 posts

Posted 10 July 2017 - 01:07 PM

modify php.ini file

also modify /include/config.local.php



#3 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 10 July 2017 - 01:23 PM

Hi,

 

Thanks for the reply.  Everything is properly set up in avs, php.ini, config.local.php with a 262MB max file upload size limit.  It appears the server is not recognizing the limits set in php.ini.  I set everything for 262Mb max but you can upload a video file that is over 1Gb!  The server simply is not preventing the larger file from being uploaded.  I'm running php5 so I'm wondering if I need a php5.ini file.

 

Thanks,

Brian



#4 myavsforums

myavsforums

    Junior Member

  • Members
  • PipPip
  • 66 posts

Posted 10 July 2017 - 05:22 PM

there are multiple of them

limit for guests or visitors, limit for registered users, limit for premium users



#5 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 10 July 2017 - 06:04 PM

that's permissions to upload for the different type of users that I believe you are referring to.  When someone is uploading a video on my server they can upload an unlimited size video.  the form limits, the php code and even server limits(php.ini) are not preventing large uploads.  Only thing I have not done is create new php.ini/php5.ini files for the document root and add them to the httpd.config file to see if that makes a difference.

 

Thanks,

brian



#6 dargre

dargre

    Senior Member

  • Members
  • PipPipPipPipPip
  • 991 posts

Posted 11 July 2017 - 02:09 AM

There can be multiple php ini files at different location. You need to find one which is applied for specific host.


VIDEO.JS - best HTML5 player in the world for AVS script

NUEVOPLAYER 8 - best flash+html5 player for video scripts
Mods, custom code by NuevoLab (Search Suggest, Multiple image upload, Seo mods,and much more)


#7 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 11 July 2017 - 03:00 AM

I did check, with phpinfo. it shows Loaded Configuration File /usr/local/lib/php.ini

 

and I set the max post and upload file size to 262Mb.  The avs upload page does not respond to those settings or the setting in avs.  I have checked and the 262Mb is being passed to the /videos/upload 

 

<input type="hidden" name="MAX_FILE_SIZE" value="{$upload_max_size}" />

 

page info shows

 

<input type="hidden" name="MAX_FILE_SIZE" value="274726912" />

 

 

Therefore I know it is being passed to /modules/upload/videos.php

 

Where error handling is not responding there either

 

             if ( $space > $upload_max_size) {

                $errors[]   = translate('upload.video_size_invalid', $config['video_max_size']);
            }
 
 
Even as we speak huge uploads are taking place lol.  I have limited space on my server so I have to limit video file size as I will run out of space literally in the next few days!
 
Thanks,
Brian

Edited by brianatthebeach, 11 July 2017 - 05:43 AM.


#8 myavsforums

myavsforums

    Junior Member

  • Members
  • PipPip
  • 66 posts

Posted 11 July 2017 - 10:32 AM

I will send you my pho.ini
One thing I did was I avoid M
I just put bytes as digit
Instead of 1M I put 1000000

Edited by myavsforums, 11 July 2017 - 10:32 AM.

  • myavsforums likes this

#9 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 11 July 2017 - 12:58 PM

appreciate it, i'll give that a try.

 

Brian



#10 dargre

dargre

    Senior Member

  • Members
  • PipPipPipPipPip
  • 991 posts

Posted 12 July 2017 - 02:06 AM

You don't have to bother about siteadmin max upload size value, you can always set max upload size manually in "/modules/upload/video.php"

 

 

$config['video_max_size'] = 500;

This allows maximum 500MB uploads. Set it as you want. This is value in MB.

You can put such line below first line:

 

 

defined('_VALID') or die('Restricted Access!');

 

You should also care about your disk space.

Delete all files from "/tmp/logs/"

Delete all source video files from "/media/videos/vid/"

 

You can also have many log or stat files generated during conversion. They can occupy really lof of space, but are completely useless.

Just delete all files, but not "mp4" from "/media/videos/hd/" and from "/media/videos/iphone/"

 

On almost all clients servers I found that nobody cares about useless files, and this can be even more than 50% of all files.


Edited by dargre, 12 July 2017 - 02:12 AM.

VIDEO.JS - best HTML5 player in the world for AVS script

NUEVOPLAYER 8 - best flash+html5 player for video scripts
Mods, custom code by NuevoLab (Search Suggest, Multiple image upload, Seo mods,and much more)


#11 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 12 July 2017 - 01:29 PM

Thanks for the input dargre.  I always delete all unnecessary files, including the uploaded file after conversion.  Server space is simply an issue that I don't want to pay for more HDD.  I only convert iphone video and that is taking up my 2Tb of HDD space  I will eventually run out of space no matter how many files I delete unless I add larger drives on my server.  For now I would like the user to get an error(exception) when they choose a file that exceeds the filesize limit.

 

I have put limits in the page as you mentioned.  What is happening now is the file size is recognized by the server and is limiting the size of the uploaded file but the user does not find out with an error message.  The script is not catching a file maximum size exceeded exception as the script is supposed to do.  The user has to wait and if the file is too big they either get a blank page from a script timeout or the upload page is reloaded with no error.  The user wastes time and thinks the file uploaded.

 

I would like the script to work as designed but since it isn't I have tried to fix by testing various $_Files array variables, for example

 

             $space = filesize($_FILES['video_file']['tmp_name']);
//                        $space = $_FILES['video_file']['size'];
//                        $space = $_SERVER['CONTENT_LENGTH'];
//             $request = http_build_query($_POST);
// $space = strlen($request);
             if ( $space > $upload_max_size) {
                $errors[]   = translate('upload.video_size_invalid', $config['video_max_size']);
            }
 

Anyway, I still would like suggestions on how to tell the user their file is too big, if anyone has any suggestions on how to do this.  I will be trying to fix the code but I'm not sure why the $_Files array is not working.

 

PS

 

I forgot that the error handling is done is

 

jquery.upload-0.1.js

 

 

I'm wondering if I can pass the actual file size to jquery.upload-0.1.js from the form.

 

PPS

 

I was able to pass the size of the file to 

 

jquery.upload-0.1.js

 

with

 

var video_file_size = $("input[id='upload_video_file']")[0].files[0].size;

 

and then do some error checking to stop the upload if it exceeds the setting in avs.

 

                if ( video_file_size > upload_max_size ) {
                error = true;
                $(size_error).html(video_size_exceeded);
                $(size_error).fadeIn();
$("div[id='upload_file']").addClass( " has-error" );
            } else {
                if ( $(size_error).is(':visible') ) {
                    $(size_error).hide();
                }
            }
 

if anyone wants to know more let me know.

 

BTW, this is based on an html5 api so it will not work in older browsers.  May not work in some modern browsers without tweaking this line

 

var video_file_size = $("input[id='upload_video_file']")[0].files[0].size; <---------works in chrome the browser I am testing with

 

some browsers are known to use this line to pass the filesize

 

var video_file_size = $("input[id='upload_video_file']")[0].files[0].FileSize;

 

 

Thanks

Brian


Edited by brianatthebeach, 15 July 2017 - 01:40 PM.


#12 dargre

dargre

    Senior Member

  • Members
  • PipPipPipPipPip
  • 991 posts

Posted 13 July 2017 - 12:38 AM

In php file size remains unknown until uploaded to server when form submitted. Error should appear on submitted form if the file exceeds limit.

It's easy o find in php:

            $space = filesize($_FILES['video_file']['tmp_name']);
            if ( $space > $upload_max_size ) {
                $errors[]   = translate('upload.video_size_invalid', $config['video_max_size']);
            }

Javascript file size check doesn't work on pre IE 10 and only has partial support in android and ios, so PHP fallback is like must.


VIDEO.JS - best HTML5 player in the world for AVS script

NUEVOPLAYER 8 - best flash+html5 player for video scripts
Mods, custom code by NuevoLab (Search Suggest, Multiple image upload, Seo mods,and much more)


#13 brianatthebeach

brianatthebeach

    Member

  • Members
  • PipPipPip
  • 107 posts

Posted 13 July 2017 - 03:38 AM

I tweaked the existing php errors a little to give a more precise error message.  Any browser not supporting jquery and the html5 api will receive an error.

 

Thanks,

Brian