FileUpload String saved
how do i save the image string without it saving as "opportunity_images/ ... "
Solution:Jump to solution
Can you remove the prefix when you are getting the value from the database? Does it impact other parts of the app to have the prefix in the DB?
12 Replies
it goes to the right folder but stores the path to database
Solution
Can you remove the prefix when you are getting the value from the database? Does it impact other parts of the app to have the prefix in the DB?
yes because i get the image like this
im confused. you marked this as already solved, but is it?
no, i didnt mean to
@Gush why would you not simply get images as
src="{{ url('storage/' . $getRecord()->thumbnail) }}
?organization
@Gush my point is that its already part of the filename that is stored
Yeah, I don't understand what's more organized about removing the prefix from the DB? If the file is really in a folder on the disk, you'll need to add the prefix to the path sooner or later, or am I missing something?
My advice would be don't fight the system. Pretty much every form / app building kit I've ever used in any framework stores the relative path from the content / virtual disk root when uploading files. Trying to buck that means overriding default behavior, and potentially introducing more problems in the future if there is other code internally that assumes how the path is built.
Just go with the conventions. Same as any convention in Laravel. Sure, you can do it some other way, but you're just making extra work for yourself.
"This question is already marked as solved"
⬆️ somebody mark Hugh answer as solution pls
I had the same issue. I do not want the folder path in the database column, as I model this. I was using an
Action
so I was able to manipulate the column and remove the path before the action saved the model.