Back
VFS
VFS
VFS
Forward


Step 7: File Uploads and Virtual File Storage

Never use uploaded files unchecked!

Horde_Browser has support for file uploads and downloads.


<?php

/* Check for uploaded MP3 file. */
$uploaded = Browser::wasFileUploaded('file');
if (
is_a($uploaded, 'PEAR_Error')) {
    if (
$uploaded->getCode() != UPLOAD_ERR_NO_FILE) {
        
$notification->push($uploaded, 'horde.warning');
    }
} else {
    
$form->getInfo($variables, $info);
    
$tags = Mopple::addFile($id, $info['file']);
    if (
is_a($tags, 'PEAR_Error')) {
        
$notification->push(_("But there was an error with the uploaded file: ") . $tags->getMessage(), 'horde.warning');
    } else {
        
$result = $driver->update($id,
                                  
$variables->get('song_title'),
                                  
$variables->get('song_artist'),
                                  
$variables->get('song_album'),
                                  
$tags);
    }
}

?>