src/Blob/BlobUtil.php
public static function validateUpload($FILE_DESCRIPTOR, $SAFETY_CHECK=true)
    {
        $retval = true;
        $filename = isset($FILE_DESCRIPTOR['name']) ? basename($FILE_DESCRIPTOR['name']) : false;

        if ( $FILE_DESCRIPTOR['error'] == 1) {
            $retval = _m("General upload failure");
        } else if ( $FILE_DESCRIPTOR['error'] == 4) {
            $retval = _m('Missing file, make sure to select file(s) before pressing submit');
        } else if ( $filename === false ) {
            $retval = _m("Uploaded file has no name");
        } else if ( $FILE_DESCRIPTOR['size'] < 1 ) {
            $retval = _m("File is empty: ").$filename;
        } else if ( $FILE_DESCRIPTOR['error'] == 0 ) {
            if ( $SAFETY_CHECK && preg_match(self::BAD_FILE_SUFFIXES, $filename) ) $retval = _m("File suffix not allowed");
        } else {
            $retval = _m("Upload failure=").$FILE_DESCRIPTOR['error'];
        }
        return $retval;
    }
public static function validateUpload($FILE_DESCRIPTOR, $SAFETY_CHECK=true)
    {
        $retval = true;
        $filename = isset($FILE_DESCRIPTOR['name']) ? basename($FILE_DESCRIPTOR['name']) : false;

        if ( $FILE_DESCRIPTOR['error'] == 1) {
            $retval = _m("General upload failure");
        } else if ( $FILE_DESCRIPTOR['error'] == 4) {
            $retval = _m('Missing file, make sure to select file(s) before pressing submit');
        } else if ( $filename === false ) {
            $retval = _m("Uploaded file has no name");
        } else if ( $FILE_DESCRIPTOR['size'] < 1 ) {
            $retval = _m("File is empty: ").$filename;
        } else if ( $FILE_DESCRIPTOR['error'] == 0 ) {
            if ( $SAFETY_CHECK && preg_match(self::BAD_FILE_SUFFIXES, $filename) ) $retval = _m("File suffix not allowed");
        } else {
            $retval = _m("Upload failure=").$FILE_DESCRIPTOR['error'];
        }
        return $retval;
    }
public static function validateUpload ( $ FILE_DESCRIPTOR , $ SAFETY_CHECK = true ) { $ retval = true ; $ filename = isset ( $ FILE_DESCRIPTOR [ 'name' ] ) ? basename ( $ FILE_DESCRIPTOR [ 'name' ] ) : false ; if ( $ FILE_DESCRIPTOR [ 'error' ] == 1 ) { $ retval = _m ( "General upload failure" ) ; } else if ( $ FILE_DESCRIPTOR [ 'error' ] == 4 ) { $ retval = _m ( 'Missing file, make sure to select file(s) before pressing submit' ) ; } else if ( $ filename === false ) { $ retval = _m ( "Uploaded file has no name" ) ; } else if ( $ FILE_DESCRIPTOR [ 'size' ] < 1 ) { $ retval = _m ( "File is empty: " ) . $ filename ; } else if ( $ FILE_DESCRIPTOR [ 'error' ] == 0 ) { if ( $ SAFETY_CHECK && preg_match ( self :: BAD_FILE_SUFFIXES , $ filename ) ) $ retval = _m ( "File suffix not allowed" ) ; } else { $ retval = _m ( "Upload failure=" ) . $ FILE_DESCRIPTOR [ 'error' ] ; } return $ retval ; }
Returns true if this is a good upload, an error string if not
Returns true if this is a good upload an error string if not