SproutCMS

This is the code documentation for the SproutCMS project

class Upload

This class is deprecated


This is old Kohana cruft

Upload helper class for working with the global $_FILES array and Validation library.

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-11-25
**/
class NewClassName extends Upload {
    
    /**
    * Tests if input data is valid file type, even if no upload is present.
    **/
    public function valid (array $file) {
        // Method code goes here
    }
    
    /**
    * Tests if input data has valid upload data.
    **/
    public function required (array $file) {
        // Method code goes here
    }
    
    /**
    * Validation rule to test if an uploaded file is allowed by extension.
    **/
    public function type (array $file, array $allowed_types) {
        // Method code goes here
    }
    
    /**
    * Validation rule to test if an uploaded file is allowed by file size.
    * File sizes are defined as: SB, where S is the size (1, 15, 300, etc) and
    * B is the byte modifier: (B)ytes, (K)ilobytes, (M)egabytes, (G)igabytes.
    * Eg: to limit the size to 1MB or less, you would use &quot;1M&quot;.
    **/
    public function size (array $file, array $size) {
        // Method code goes here
    }
    
    /**
    * Save an uploaded file to a new location.
    **/
    public function save (mixed $file, string $filename, string $directory, integer $chmod) {
        // Method code goes here
    }
    
}
?>