public function addFile($file, $duration, $password)
 {
     $torrentfile = explode('|', $file);
     if (count($torrentfile) > 1) {
         $file = array($torrentfile[1], $torrentfile[0]);
     }
     if (is_array($file)) {
         $file = \Flm\Helper::getTorrentHashFilepath($file[0], $file[1]);
     } else {
         $file = fullpath(trim($file, DIRECTORY_SEPARATOR), $this->userdir);
     }
     $this->validDuration($duration);
     $share = Storage::load();
     if ($this->islimited('links', $share->size())) {
         throw new Exception("File limit reached " . $share->size(), 2);
     }
     if (($stat = LFS::stat($file)) === FALSE) {
         throw new Exception("Invalid file " . $file, 2);
     }
     $data = array('path' => $file, 'size' => $stat['size'], 'expire' => time() + 3600 * $duration, 'password' => $password);
     return $share->add($data);
 }