-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] The upload field contains the wrong url #5232
Comments
Thanks for the report @CamusMX7 I fixed a similar issue for "non-repeatable" uploaders last week I guess I missed this usecase. I will have a look at it ASAP 👍 Cheers |
Fixed the issue in: #5233 Just tagged https://github.com/Laravel-Backpack/CRUD/releases/tag/6.0.7 along with some other fixes. Let me know if it still does not work for you @CamusMX7 🙏 Thanks |
@pxpm I keep seeing the same problem with the URL I already had saved (castings/1-1-tSzR.mp3). "The path (castings)" continues to be duplicated.
Controller
model
Even in the list it is displayed correctly, but in the form it is not. UPDATED I forgot to mention that I did a general
|
Hey @CamusMX7 thanks for the report. But let's not mix issues or it gets very difficult to me to keep up with what you report. If needed always open a new issue with a different topic, we don't charge by issues opened 😄 Let's focus on the upload issue here. I've just reverted my last PR. And I wasn't able to get json on the setter. // the model
protected $fillable = ['name', 'extras', 'meta'];
protected $casts = ['meta' => 'json'];
public function setMetaAttribute($value) {
dd($value, $this);
}
// the controller
CRUD::field('name')->type('upload')->withFiles(['path' => 'olanina']);
CRUD::field('meta')->type('repeatable')->subfields([
[
'name' => 'test',
'type' => 'text'
],
[
'name' => 'test_upload',
'type' => 'upload_multiple',
'withFiles' => [
'path' => 'testpath'
],
],
]); And when I submit the form and What I am missing @CamusMX7 ? |
Sorry for mixing issues, but since the update I've been suffering a bit. Concentrating on the upload field in repeatable. If I use it by saving the json in a field of my database, EVERYTHING works fine, the data is saved, the URL and it shows the url correctly in the form. But if I try to store in a pivot table now nothing related to the upload field works fine. DB
If I insert the url of the file directly into the database, for example in the "audioc" field: "castings/file.mp3" when it is displayed in the form it keeps repeating "castings/castings/file.mp3" which was my initial problem. Now, with your example trying to replicate the situation, can you delete the url of your file and try getting the new file? To be clearer, could you print what you receive with the following? and could you confirm that you receive the new value of the upload field and not the value stored in the database?
|
Hey @CamusMX7 thanks for getting back. I could reproduce your issue and I am working on the fix. #5243 The previous fix I made like you said, only accounted for I am almost done, If I have a little time during this weekend I may be able to finish it, otherwise I finish it at the beginning of next week. Thanks again 🙏 |
Hello @pxpm , Is there any news about this? I see that it is marked as closed, but I never found a solution.
But I still can't get the URL to store it in the database. Thanks. UPDATE Sorry, I had not reviewed in detail what was proposed in: Which apparently was the solution to this issue. BUT, what happens in specific cases where I handle relationships differently? |
Bug report
What I did
I added the "withFiles" property that includes the path in a subfield of the repeatable field.
What I expected to happen
It will upload the file and show the correct path to the file.
What happened
In the "href" it repeats the name of the path declared in "withFiles" and therefore the path is incorrect when clicking the link.
What I've already tried to fix it
Nothing yet
Is it a bug in the latest version of Backpack?
Yes
Backpack, Laravel, PHP, DB version
backpack/basset: 1.0.0
backpack/crud: 6.0.6
backpack/generators: v4.0.1
backpack/permissionmanager: 7.0.0
backpack/pro: 2.0.8
backpack/theme-coreuiv2: 1.1.3
backpack/theme-tabler: 1.0.5
The text was updated successfully, but these errors were encountered: