Exemplo n.º 1
0
            $allowedExtensions = array('jpg', 'JPG', 'jpeg', 'JPEG', 'png', 'PNG');
        } else {
            if ($exttype == 'srt') {
                $allowedExtensions = array('srt', 'SRT');
            }
        }
    }
}
if (!iserror()) {
    if ($pro == 1 && empty($_FILES['myfile'])) {
        $errorcode = 13;
    } else {
        $file = $_FILES['myfile'];
        if (no_file_upload_error($file)) {
            if (is_allowed_extension($file)) {
                if (!filesizeexceeds($file)) {
                    doupload($file);
                }
            }
        }
    }
}
/**
 * Check the  error  occur  in the upload  the  files or  not
 * @return boolean
 */
function iserror()
{
    global $error;
    global $errorcode;
    if ($error == 'cancel') {
Exemplo n.º 2
0
        } else {
            /** Else file is moved then set error code as 4 */
            $errorcode = 4;
        }
        /** Sleep 1ms */
        sleep(1);
    }
    if (!iserror()) {
        /** Set error message, if the upload and post max size is less than the upload file size */
        if ($pro == 1 && empty($_FILES['myfile'])) {
            $errorcode = 13;
        } else {
            /** Get upload file information */
            $file = $_FILES['myfile'];
            /** Check whether the upload file type is in the given extension and checks its limit */
            if (no_file_upload_error($file) && is_allowed_extension($file) && !filesizeexceeds()) {
                /** Call function to perform upload action */
                doupload($file);
            }
        }
    }
    /** Script to display error message while uploading */
    ?>
    <script language='javascript' type='text/javascript'>
        window.top.window.updateQueue( <?php 
    echo balanceTags($errorcode);
    ?>
,
        '<?php 
    echo balanceTags($errormsg[$errorcode]);
    ?>