文件输入标签Blade

时间:2015-07-13 16:29:00

标签: file laravel blade

我有一个带有文件输入字段的表单,我为输入创建了一个标签,并使输入显示为none。每当我上传图片时,它都会自动提交表格。但问题是,如果我这样提交,它会返回带有链接的错误ID,如果我只有一个正常的提交按钮就可以了。

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
    android:fillColor="#000000"
android:pathData="M 1382,680 c 107,0 194,112 194,251 0,138 -87,250      -194,250 -2,0 -3,0 -5,0 -17,98
-85,219 -230,219 l 0,77 c 0,28 235,1 235,45 l 0,55 -556,0 0,-55 c 0,-59 235,-11
235,-45 l 0,-77 c -125,0 -211,-106 -230,-219 -1,0 -3,0 -5,0 -107,0 -195,-112
-195,-250 0,-139 88,-251 195,-251 l 0,0 0,-48 556,0 0,48 z m -555,413 -1,-325 c
0,0 0,0 0,0 -70,0 -126,73 -126,163 0,89 56,162 126,162 0,0 1,0 1,0 z m 555,-325
0,325 c 70,0 126,-73 126,-162 0,-90 -56,-163 -126,-163 z" />
</vector>

在我的路线档案中,我有以下路线

@foreach($wedstrijden as $wedstrijd)

<a class="verslag-manager-button" data-toggle="modal" data-target="#verslagModal{{ $wedstrijd->id }}" href="">
  <p>Verslag </p>
</a>

--modal #verslagModal{{ $wedstrijd->id }}
<form action="/manager/fotos/upload/{{ $wedstrijd->id }}" class="upload" method="post" enctype="multipart/form-data">

    <label class="btn btn-default btn-success" for="my-file-selector">
        <input onchange="this.form.submit()" id="my-file-selector" multiple name="sourceImage[]" type="file" style="display:none;">
        Upload Foto
    </label>

    <input type="hidden" name="_token" value="{{ csrf_token() }}">

    <input style="display: none" type="submit" value="Upload Image" name="submitBtn">

</form>
--modal
@endoforeach

但在我的控制器中,它总是返回最新的id。

如果我在浏览器中检查我的代码,则表单url会显示Route::post('manager/fotos/upload/{id}', 'managerController@postFotoUpload'); ,但如果我将/manager/fotos/upload/16转储到我的控制器中,它将返回17。

$id

0 个答案:

没有答案