What entry do you mean?
You can use your native language as a fallback %)
What entry do you mean?
You can use your native language as a fallback %)
english
If you attempt to write to the file, frays. I can not understand how to add content to the file. I would like to see an example of this kind.
russia
При попытке записи в файл, файл перетирается. Не могу понять, как именно добавить контент в конец файла. Хотелось бы увидеть пример именно такого рода.
$cfile = Yii::app()->file->set('/var/www/test/file.conf');
$cfile ->setContents('content');
What am I doing wrong?
Что я делаю неправильно?
I’m sorry, I haven’t got a lot of speaking practise.
Только что увидел в профиле Новосибирск ), сразу повеяло чем то родным
to the end file content
example
thank you idle sign
The second param should be a boolean, not a string to make it the right way. E.g.:
$cfile->setContents('content', true, FILE_APPEND);
Hi, thanks for the great extension
how to return only sub directory in get content?
i have a code like this
$cfileDir = Yii::app()->file->set('/mydir');
print_r($cfileDir->getContents(true));
Do you mean how to get only the contents of a directory? Obviously do not use a recursion, i.e. set $recursive param of getContents() to False.
Hi, thanks. It works. Never thought of that ^^
how create new folder with CFile
Hi
I installed the extension and checked it with some examples. It works.
I have a question.
How can I let user to download audio (zipped) file?
I managed to get the filtered file name (view-controller-model-view):
$file = CHtml::encode($data->file);
But I cannot use it in the code:
$cfileDir = Yii::app()->file->set(‘c://xampp/htdocs/files/audio/’);
$myfile = Yii::app()->file->set(’$cfileDir’, true);
$myfile->download(’$file’, true);
As I mentioned above it works when I use the file name in example (I have dialog popped up):
$myfile->download(‘myfastfile.txt’, true);
However I cannot succeed to insert $file in place of ‘myfastfile.txt’.
Can somebody please help?
Thanks.
Hi,
First of all, thanks for this class…
I’ve found an error in setContents method:
If I set autocreate to true, it never creates the file because it validates if is a file before and that will never happen.
Sorry for my english!
Thanks again!
Hi, there’s small sample, for create a new file and write in it ? At the end, I wish send it for download thanks
[solved]
$webroot = Yii::getPathOfAlias(‘webroot’);
$path = $webroot . DIRECTORY_SEPARATOR . ‘downloads’ . DIRECTORY_SEPARATOR . ‘paco.dat’;
$cfile = Yii::app()->file->set($path);
if($cfile->create()){
$cfile ->setContents($file_content,true, FILE_APPEND);
}
//CVarDumper::dump($cfile,10,true);die();
//for send to browser
$cfile->send();