Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Incomplete = errors.New("Incomplete")
Error Incomplete returned by uploader when loaded non-last chunk.
Functions ¶
func TempFileChunks ¶
Returns a temporary file to download chunk. To calculate a unique file name used cookie named pavo and the original file name. File located in the directory chunks storage root directory. Before returning the file pointer is shifted by the value of offset, in a situation where the pieces are loaded from the second to the last.
Types ¶
type OriginalFile ¶
Structure describes the state of the original file.
func Process ¶
func Process(req *http.Request, storage string) ([]*OriginalFile, error)
Downloading files from the received request. The root directory of storage, storage, used to temporarily store chunks. Returns an array of the original files and error. If you load a portion of the file, chunk, it will be stored in err error Incomplete, and in an array of a single file. File size will fit the current size.
func (*OriginalFile) Ext ¶
func (ofile *OriginalFile) Ext() string
type Uploader ¶
Upload manager.
func (*Uploader) Reader ¶
Returns the reader to read the file or chunk of request body and the original file name. If the request header Conent-Type is multipart/form-data, returns the next copy part. If all of part read the case of binary loading read the request body, an error is returned io.EOF.
func (*Uploader) SaveFile ¶
func (up *Uploader) SaveFile() (*OriginalFile, error)
Function loads one or download the original file chunk. Asks for the starting position in the body of the request to read the next file. Asks for a temporary file. Writes data from the request body into a temporary file. Specifies the size of the resulting temporary file. If the query specified header Content-Range, and the size of the resulting file does not match, it returns an error Incomplete. Otherwise, defines the basic mime type, and returns the original file.
func (*Uploader) SaveFiles ¶
func (up *Uploader) SaveFiles() ([]*OriginalFile, error)
Function SaveFiles sequentially loads the original files or chunk's.