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

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 ?

Related

Create a .txt file and store it on a specific folder 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').

Laravel putFile method error file does not exist but putFileAs works fine

I want to download and store some icon image files. first of all I tried using Storage::putFileAs method. It downloads the file normally but there is a problem with this method as it doesn't add the file extension to file name and I don't know how can I get the file extension before using this method. But I tried using putFile to see if it will guess file extension but it gives me error below on same url.
Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException with message 'The file "https://assets.coingecko.com/coins/images/780/thumb/bitcoin_cash.png?1547034541" does n ot exist'
I used tinker framework to test this method before using in my project.
So my main question is why putFile doesn't stream the file whereas putFileAs does.
and my second question is how can I download and save an image file with specific file name without need to find the file extension in Laravel?
Storage::putFile('photos', "https://assets.coingecko.com/coins/images/780/thumb/bitcoin_cash.png?1547034541") // FileNotFoundException
Storage::putFileAs('photos', "https://assets.coingecko.com/coins/images/780/thumb/bitcoin_cash.png?1547034541",'test') // Finds the file but I don't know how to add file extention

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");

WP7 + Live SDK - file overwrite doesn't work

I'm trying to upload a file to SkyDrive using Live SDK. It works well except overwriting existing files. Whenever I try to overwrite an existing file I get the error message "The resource file_name already exists.", although I use the Overwrite option:
_liveClient.UploadAsync(
FolderId,
Filename,
MemoryStream,
OverwriteOption.Overwrite);
Is there anything else I need to set?
I could try handling the error by deleting the file and uploading again but that's obviously not the cleanest way to do that.
Microsoft admitted here that it's a bug that they are aware of . It will be fixed in the next release.
Also, as per answer in that link, the overloaded method works fine:
_liveClient.UploadAsync(
FolderId,
Filename,
MemoryStream,
OverwriteOption.Overwrite,
null);
When your upload a file, and a file with the same name already exists in the same location in SkyDrive, the default behavior is for SkyDrive to overwrite the existing file. You are not required to specify OverwriteOption.
From my point of view, there is a problem else where. Try to use another folder and show a little more code.

Resources