Pages

15 October, 2023

Laravel 9 Upgrade: Write Operations Now Overwrite Existing Files

Per the v9 upgrade guide, "write operations such as put, write, and writeStream now overwrite existing files by default."

I'm not exactly sure what "overwriting existing files" means in this context. From what I've observed, Storage::put() operates the same way on both Laravel 8 and 9. That is, if the file exists, then put() replaces that file's contents with what's passed into the $contents argument -- it doesn't append the contents to the file, nor does it delete the original file and create a new one (it modifies the original file).

I'm trying to upgrade our Laravel 8 app to version 9, and this is the last item on the checklist that I have to get through. I was stumped because I'm not noticing any difference in the behavior of Storage::put() between v8 and v9.

Can anyone provide any context, insight, or example to demonstrate? submitted by /u/mattk1017
[link] [comments]

No comments:

Post a Comment

Thanks