php - 400 bad request when put enctype="multipart/form-data" in my form
one text
<form action="{{ route('api.form-di') }}" file='true' method="POST" role="form" class="wpcf7-form init contact-page" enctype="multipart/form-data" data-status="init">
@csrf
<div style="display: none;">
<input type="hidden" name="_wpcf7" value="249">
<input type="hidden" name="_wpcf7_version" value="5.5.6.1">
<input type="hidden" name="_wpcf7_locale" value="pt_BR">
<input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f249-o2">
<input type="hidden" name="_wpcf7_container_post" value="0">
<input type="hidden" name="_wpcf7_posted_data_hash" value="">
</div>
<h2>{{__('Form DI')}}</h2>
<div class="form-group">
<span class="wpcf7-form-control-wrap nome">
<input type="text" name="numero" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required form-control" aria-required="true" aria-invalid="false" placeholder="{{ __('Number DI') }}">
<span role="alert" class="wpcf7-not-valid-tip" id="numero-alert"></span>
</span>
</div>
<div class="form-group">
<span class="wpcf7-form-control-wrap email">
<input type="text" name="email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required form-control" aria-required="true" aria-invalid="false" placeholder="{{ __('Your e-mail') }}">
<span role="alert" class="wpcf7-not-valid-tip" id="email-alert"></span>
</span>
</div>
<div class="form-group">
<span class="wpcf7-form-control-wrap curric">
<input id='anexo-di' style="border: 1px solid var(--color-orange);" type="file" name="anexo-di" size="40" class="wpcf7-form-control wpcf7-file form-control" accept=".pdf,.doc,.docx,.xls" aria-invalid="false">
<span role="alert" class="wpcf7-not-valid-tip" id="resume-alert"></span>
<div class="testando"></div>
</span>
</div>
<div class="form-group">
<span class="wpcf7-form-control-wrap msg">
<textarea name="message" cols="40" rows="5" class="wpcf7-form-control wpcf7-textarea form-control" aria-invalid="false" placeholder="{{ __('Message') }}"></textarea>
<span role="alert" class="wpcf7-not-valid-tip" id="message-alert"></span>
</span>
</div>
<div class="form-group">
<span class="wpcf7-form-control-wrap news">
<span class="wpcf7-form-control wpcf7-checkbox">
<span class="wpcf7-list-item first last">
<input type="checkbox" name="send_me" value="1" />
<span class="wpcf7-list-item-label">{{ __('Send copy to me') }}</span>
</span>
</span>
</span>
</div>
<div class="form-group">
<input type="submit" value="{{ __('Send') }}" class="wpcf7-form-control has-spinner wpcf7-submit btn btn-primary btn-transp">
</div>
<div class="wpcf7-response-output" id="response-output" aria-hidden="true">
{{ __('Sent with success') }}
</div>
</form>
When I put the enctype="multipart/form-data"
to read input type type, it returns 400 bad request
route
use App\Http\Controllers\Site\SiteApiController;
use Illuminate\Support\Facades\Route;
Route::middleware('language')->name('api.')->group(function () {
Route::get('news', [SiteApiController::class, 'newsSearch'])->name('news');
Route::post('contact-us', [SiteApiController::class, 'contactUs'])->name('contact-us');
Route::post('form-di', [SiteApiController::class, 'formDI'])->name('form-di');
Route::post('work-with-us', [SiteApiController::class, 'workWithUs'])->name('work-with-us');
});
Need help to solve this
Source