Create a .txt file and store it on a specific folder Laravel - laravel

So basicly, I have to make a Laravel command which will create a .txt file. The command accepts as arguments the index of the file(id) and one or more tokens(words inside file). I am finding unable to create the file with it's content inside my desired folder(Called 'files' inside the root directory).
I found a way to create it inside the Storage, but that's not exactly what i need.
Would appreciate some help, thank you

Check out the filesystems.php file and add a specific configuration for the directory you want to read/write. After doing so, you will be able to create a file using the File facade by specifying your disk like so: File::disk('my-disk').

Related

File::make('Fichier', 'path')->storeOriginalName('original_name') gives me gEUBH18u1UdjoPBS0POQB64xit5PF05Rnl8M5lMI.pdf

I'm using Laravel Nova,
I want to upload a file to S3. As this file is generated automatically, I know it has already a good naming. So, I want to keep original filename. But when using:
File::make('Fichier', 'path')
->disk('s3')
->storeOriginalName('path')
I realized that my file, originally named FILE1.pdf now is named gEUBH18u1UdjoPBS0POQB64xit5PF05Rnl8M5lMI.pdf
Why ?

How to append the file using Ansible

I'm trying to append a file to the existing file. When I hit a specific url I get the updated data everytime. my requirement is to append the updated to the same file instead of creating a new file everytime. I'm using get_url module to get the file. but the file is not being updated. If I give the destination as new file then data is being copied to new file.
get_url doesn't appear to support that operation. You may need to retrieve the file and use the Assemble module to concatenate (or combine) the files.

Special path to files with fine-upload

I want to transfer files in different folders on the server.
I did not find an option in the documentation to do this. Is it possible?
Assuming you are using php endpoint, you can user php rename function as following after the file is uploaded.
rename("user/image1.jpg", "user/del/image1.jpg");

Dynamically updating config data codeigniter

I have created my custom config file to store information about site such as if it is online or offline like-vice.
For that I have created new file in config folder and stores default values in global $config[] array with my own index.
I want to update these config data dynamically with admins control eg. he can select to put site in offline mode.
For that I have used function
$this->config->set_item('config_array_index','value_to_set');
but, I don't know why it is not working for me ?
I am not able to see any update in my config file. Also I am autoloading my config file.
Am I missing something?
Setting a config item only applies to the current session - it does not overwrite your actually codeigniter files.
If you want to permanetly take a site offline, your'll need some sort of persistant storage, such as a value in a database that is checked/updated as needed
you can create an empty config file, within your config directory , and then append your data to it using a functionality like fwrite ( you can check for some other CI function to use ).
and add it to your autoload file .

Create new file with custom file extension?

How can I create a new file with a file format of say .kuy.This file would be holding encrypted data. And then later I could choose that file with extension .kuy to decrypt. So if I encrypted soundfile.aup, the encrypted file would be soundfile.aup.kuy, then the user would proceed to decrypting that file in which case the output would be soundfile.aup.
Thank you,
Bobby
You can assign a file extension to your application by going to your Target's info window and selecting the Properties tab:
After that, you just need to add your desired extension when you save a file.
As Steve suggests, first you have to create a custom file format. After that, whenever a custom file gets open - double click or whatever - its path will be passed to application:openFile:. http://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008592-CH1-SW29
Once you have the path, do your logic and you should be fine.

Resources