Adds the file to the set.

@param int|FileEntity|FileVersionEntity $f_id

@return \Concrete\Core\File\Set\File|null returns NULL if the operation failed (for instance because $f_id is invalid), a \Concrete\Core\File\Set\File instance otherwise
769233
public function addFileToSet($f_id)
    {
        $app = Application::getFacadeApplication();
        if (is_object($f_id)) {
            $f = $f_id;
            if ($f instanceof FileEntity) {
                $file = $f;
                $fileVersion = $file->getApprovedVersion();
            } else {
                $fileVersion = $f;
                $file = $fileVersion->getFile();
            }
            $f_id = (int) $file->getFileID();
        } else {
            $f_id = (int) $f_id;
            $em = $app->make(EntityManagerInterface::class);
            $file = $em->find(FileEntity::class, $f_id);
            $fileVersion = $file->getApprovedVersion();
        }
        if ($file === null) {
            $result = null;
        } else {
            $file_set_file = File::createAndGetFile($f_id, $this->fsID);
            $fe = new \Concrete\Core\File\Event\FileSetFile($file_set_file);
            $director = $app->make(EventDispatcherInterface::class);
            $director->dispatch('on_file_added_to_set', $fe);
            if ($fileVersion !== null && $this->shouldRefreshFileThumbnails('add')) {
                $fileVersion->refreshThumbnails(false);
            }
            $result = $file_set_file;
        }

        return $result;
    }
156093
public function setFile(File $file = null)
    {
        $this->file = $file;

        if (!empty($file)) {
            $size = @getimagesize($file->getPathname());

            if (is_array($size)) {
                list($this->width, $this->height) = $size;
            }

            $this->refreshUpdatedAt();
        }

        return $this;
    }
510898
protected function addFile()
    {
        if (!$this->isError()) {
            $id = $this->file->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
1021713
public BoxRequestsFile.CreateNewVersionUploadSession getCreateUploadVersionSessionRequest(File file, String fileId)
            throws FileNotFoundException {
        return new BoxRequestsFile.CreateNewVersionUploadSession(file, getUploadSessionForNewFileVersionUrl(fileId), mSession);
    }
260225
public function putFile(File $file, $newName = null)
    {
        if($file == null){
            return null;
        }
        $name = $newName == null?$file->getFilename():$newName;

        if(($f = $file->copy($this->folderPath."/".$name)) == null){
            return null;
        }


        return $f;

    }
879413
public function setFolderId( $folder_id )
	{
		$this->folder_id = (is_numeric($folder_id)) ? abs(round($folder_id)) : NULL;

		return $this;
	}
183478
public function attachFile($id, $table, \Symfony\Component\HttpFoundation\File\UploadedFile $file)
    {
        $newFileName = md5(microtime() . '.' . strtolower($file->getClientOriginalExtension()));
        $relativePath = $table . '/' . date('Y/m/d');
        $relativeFilePath = $relativePath . '/' . $newFileName;
        $dstPath = APP_UPLOADS_DIR . '/' . $relativePath;
        $file->move($dstPath, $newFileName);
        $pic = new \Towel\Model\Pic();

        $pic->object_id = $id;
        $pic->object_type = $table;
        $pic->pic = $relativeFilePath;
        $pic->created = time();
        $pic->save();
    }
1321140
public function addFile(\Haven\CoreBundle\Entity\File\File $file)
    {
        $this->files[] = $file;

        return $this;
    }
1339034
public function delete($file_id)
    {
        if (empty($file_id)) {
            return false;
        }

        $deleted = $count = 0;
        foreach ((array) $this->file->getList(array('file_id' => $file_id)) as $file) {
            $deleted += (int) $this->file->delete($file['file_id']);
            $count++;
        }

        return $count && $count == $deleted;
    }
742055
public function share(string $id, $concrete = null) : DefinitionInterface
    {
        return $this->add($id, $concrete, true);
    }
56030
public function add($file, $entry_name = null)
    {
        // Make sure to adapt the entry name as the original filename.
        if (isset($entry_name)) {
            $this->phar->addFile($file, $entry_name);
        }
        else {
            $this->phar->addFile($file);
        }

        return $this;
    }
6218
public function select($id = null)
    {
        if ($id instanceof \SplFileInfo) {
            $selection = new StorageSelection($id, $id->getRealPath(), $id->getFilename());

            return $selection;
        } elseif (is_string($id)) {
            if (!file_exists($id)) {
                throw new \InvalidArgumentException('id is not a valid file path: '.$id);
            }
            $selection = new StorageSelection(new \SplFileInfo($id), realpath($id), $id);

            return $selection;
        } elseif ($id instanceof StorageSelection) {
            return $id;
        }

        throw new \InvalidArgumentException('Id must be a string, an instance of SplFileInfo or a StorageSelection. Was: '.print_r($id, true));
    }
1208533
public function add(string $id)
    {
        $entity = $this->DblistItems->newEntity();

        if ($this->request->is('post')) {
            $entity = $this->DblistItems->patchEntity($entity, array_merge((array)$this->request->getData(), ['dblist_id' => $id]));

            if ($this->DblistItems->save($entity)) {
                $this->Flash->success('The database list item has been saved.');

                return $this->redirect(['action' => 'index', $id]);
            }

            $this->Flash->error('The database list item could not be saved. Please, try again.');
        }

        $tree = $this->DblistItems->find('treeList', ['spacer' => '&nbsp;&nbsp;&nbsp;&nbsp;'])
            ->where(['dblist_id' => $id]);

        $this->set(compact('entity', 'tree'));
        $this->set('_serialize', ['entity']);
    }
104155
public function get_file_by_id($fileid) {
        global $DB;

        $sql = "SELECT ".self::instance_sql_fields('f', 'r')."
                  FROM {files} f
             LEFT JOIN {files_reference} r
                       ON f.referencefileid = r.id
                 WHERE f.id = ?";
        if ($filerecord = $DB->get_record_sql($sql, array($fileid))) {
            return $this->get_file_instance($filerecord);
        } else {
            return false;
        }
    }
1181695
public function addLibrinfoFile(File $file = null)
    {
        if (!$this->images->contains($file)) {
            $this->images->add($file);
        }

        return $this;
    }
98937
public function rename($fileID, $name)
    {
        $data = [
            'file_id' => $fileID,
            'name'    => $name
        ];

        return $this->post('files/rename', $data, \true);
    }
1133362
protected function getFilesystemFor($fileID)
    {
        return $this->applyToFileIDOnFilesystem(
            function (ParsedFileID $parsedFileID, Filesystem $fs) {
                return $fs;
            },
            $fileID
        );
    }