Skip to content
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

[5.0] Fix Broken File Upload When Submitting A Form Without Selecting A File #6256

Merged
merged 10 commits into from
Nov 20, 2014

Conversation

etcinit
Copy link
Contributor

@etcinit etcinit commented Oct 28, 2014

This is my attempt at fixing (my first PR) the issue:
[5.0] File upload is broken when submitting a form without selecting a file #6189

Right now I'm overriding Symfony's Request::duplicate function so that it can handle empty file form inputs. Another solution is included in the issue (#6189), which modifies the createFromBase function. Both filter the input array to remove any files that are null.

@etcinit etcinit changed the title Fixes broken file upload when submitting a form without selecting a file #6189 [5.0] Fix broken file upload when submitting a form without selecting a file #6189 Oct 28, 2014
@etcinit etcinit changed the title [5.0] Fix broken file upload when submitting a form without selecting a file #6189 [5.0] Fix broken file upload when submitting a form without selecting a file Oct 28, 2014
@@ -608,6 +608,28 @@ public static function createFromBase(SymfonyRequest $request)
}

/**
* Clones a request and overrides some of its parameters.
*
* @param array $query
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format this docblock correctly.

@@ -608,6 +608,28 @@ public static function createFromBase(SymfonyRequest $request)
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just ?

/**
 * {@inheritdoc}
 */
public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null)
{
    $files = array_filter((array) $files);

    return parent::duplicate($query, $request, $attributes, $cookies, $files, $server);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@etcinit etcinit changed the title [5.0] Fix broken file upload when submitting a form without selecting a file [5.0] Fix Broken File Upload When Submitting A Form Without Selecting A File Oct 29, 2014
taylorotwell added a commit that referenced this pull request Nov 20, 2014
[5.0] Fix Broken File Upload When Submitting A Form Without Selecting A File
@taylorotwell taylorotwell merged commit 604ad07 into laravel:master Nov 20, 2014
@jonathanpmartins
Copy link

Thank you @Eduard44 and @taylorotwell

This bug has drives me crazy! eheheheh

@5outh
Copy link
Contributor

5outh commented Nov 20, 2014

👍

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

Successfully merging this pull request may close these issues.

6 participants