Skip to content

File upload is broken when submitting a form #12486

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

Closed
wants to merge 1 commit into from

Conversation

jonathanpmartins
Copy link

...without selecting a file in Laravel 5! My tests revealed that with this tweek the problem described at this issue are resolved: laravel/framework#6189

...in Symfony on the FileBag.php file, convertFileInformation() method returns NULL if no files was selected on the upload. In this case "FileBag->set('image', NULL)" receives NULL, and that is what is dispatching a throw!

I don't make unit tests, but this will no more break my code flow. I'm not sure if this is the real deal! If someone could look deeper into the problem, I appreciated!

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? no
Fixed tickets
License MIT
Doc PR

...without selecting a file in Laravel 5! My tests revealed that with this tweek the problem described at this issue are resolved: laravel/framework#6189 

...in Symfony on the FileBag.php file, convertFileInformation() method returns NULL if no files was selected on the upload. In this case "FileBag->set('image', NULL)" receives NULL, and that is what is dispatching a throw!

I don't make unit tests, but this will no more break my code flow. I'm not sure if this is the real deal! If someone could look deeper into the problem, I appreciated! 

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | 
| License       | MIT
| Doc PR        |
@jonathanpmartins
Copy link
Author

I'm still learning the english language and the workflow of github. Please, if I did something wrong let me know to become a better developer. :)

@xabbuh
Copy link
Member

xabbuh commented Nov 16, 2014

It seems to me that returning null is the expected behaviour. There is the testShouldSetEmptyUploadedFilesToNull test which explicitly covers this and which is now failing with your changes.

Furthermore, I don't see any sense in making file an array in case of upload errors when it is an UploadedFile object on success.

@jonathanpmartins
Copy link
Author

Thank you for your explanation, very clarifying! I'm will continue to hunt this BUG. laravel/framework#6189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants