上传MP3文件时出现未定义的变量错误,其他音频文件正常工作,并且与图像,pdf和所有普通扩展程序完美配合!这有点奇怪!!
如果有人可以帮助我感谢...
我不认为mime type
是问题所在,我已经尝试了audio\mp3
和audio\mpeg
以及更多关于mp3 mimes的交响乐常见错误,但也给出了相同的错误。
跟踪控制器
protected function create(Request $r, $slug)
{
$album = Album::where('slug', $slug)->first();
$artist = Artist::find($album->artist_id)->get();
$is = range(0,$r->ii);
foreach ($is as $i) {
if($r->hasfile('file'.$i)){
$file = $r->file('file'.$i);
$filename = $album->id . $r['name'.$i] . "." . $file->getClientOriginalExtension();
$file = Storage::putFileAs( 'tracks', $r->file('file'.$i), $filename);
$file = $filename;
}
$track[$i] = $album->tracks()->create(
[
'name' => $r['name'.$i],
'slug' => $r['name'.$i],
'album_id' => $album->id,
'artist_id' => $album->artist_id,
'track_pic' => $album->album_pic,
'file' => $file,
'release_date' => $album->release_date,
]);
}
return redirect('/album'.'/'.$album->slug);
}
创建跟踪视图
<form class="form-horizontal" role="form" method="POST" action="{{ route('track.add', $slug) }}" enctype="multipart/form-data">
{{ csrf_field() }}
<table class="table table-hover" id="tab_logic">
<tbody>
<tr id='addr0'>
<td width="70%">
<input type="text" name='name0' placeholder='Name' class="form-control"/>
</td>
<td width="30%">
<center><label class="btn btn-default btn-round"><input type="file" name='file0' style="display:none"/><span class="glyphicon glyphicon-folder-open"></span></label></center>
</td>
</tr>
<tr id='addr1'></tr>
</tbody>
</table>
<a id="add_row" class="btn btn-primary btn-round btn-icon pull-left"><span class="glyphicon glyphicon-plus"></span></a>
<a id='delete_row' class="btn btn-primary btn-round btn-icon pull-right"><span class="glyphicon glyphicon-minus"></span></a>
{{-- Loop Counter before submit --}}
<input type="hidden" id="counter" name="ii" value="">
<!-- Submit -->
<center>
<button type="submit" class="btn btn-primary">
Add
</button>
</center>
<!-- End Submit -->
</form>