Menu

File upload problems

Help
Mike
2010-04-11
2013-06-03
  • Mike

    Mike - 2010-04-11

    Hello,  the file upload doesn't seem to have a size limit. I set the max. file size  to '200' when making the form, but bigger files can be uploaded

    I have read that there is a variable called max_file size which a cannot find in my form, nor in the rest of files.  Is this variable in use ? I've read all scripts and can't find anything related to file sizes validation in them. Can you tell me if I'm missing something ?

    Thank you

     
  • TNTEverett

    TNTEverett - 2010-04-14

    Look for limits in PHP environment settings.  There are many ways to control this.  Most of the easy ways are not always reliable due to the fact that some are no longer supported and some can are canceled by higher level controls.  The harder ways are not practical for the form generator unless you really need this level of control. 

    Save this into a file and point your browser to it on your site.

    <html><body><center>
    <a href="/a/">Back</a><br><br>

    <?php
    function ss_timing_start ($name = 'default') {
        global $ss_timing_start_times;
        $ss_timing_start_times = explode(' ', microtime()); }

    function ss_timing_stop ($name = 'default') {
        global $ss_timing_stop_times;
        $ss_timing_stop_times = explode(' ', microtime()); }

    function ss_timing_current ($name = 'default') {
        global $ss_timing_start_times, $ss_timing_stop_times;
        if (!isset($ss_timing_start_times)) {
            return 0;
        }
        if (!isset($ss_timing_stop_times)) {
            $stop_time = explode(' ', microtime());
        }
        else {
            $stop_time = $ss_timing_stop_times;
        }
        // do the big numbers first so the small ones aren't lost
        $current = $stop_time - $ss_timing_start_times;
        $current += $stop_time - $ss_timing_start_times;
        return $current;
    }

    ss_timing_start();
    phpinfo();
    ss_timing_stop();
    ?>

    <hr><br><font color="red" size=4> The page was executed in: <?php echo ss_timing_current();?>  seconds. </font><br><br> <a href="/a/">Back</a> </center></body></html>

     
  • Mike

    Mike - 2010-04-15

    Thanks for you replay

    I've learned that file size cannot be validated on the client side (unless you implement some scary activeX control), so forget my question

    Thanks for the code,  it can help in wich I'm trying to do: validate size and file type (the last can be done client-side, I'm still guessing how to arrange this, any sugestion/examples are welcomed)

    Thanks

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.