sure
here is the blade form:
{!! Form::open(array('url' => '/ex1upload', 'class' => '', 'method' => 'post', 'files'=>true)) !!}
<input name="mediaable_type" type="hidden" value="App\exObj1"/>
<div class="col-xs-6 col-md-6 adjustabit2 pull-left ">
{!! Form::file('file[]', array('multiple'=>true)) !!}
</div>
<div class="col-xs-2 col-md-2 ">
<input class="" type="text" name="caption" size="22" placeholder="caption...">
<input class="" type="text" name="description" size="22" placeholder="description...">
<input name="mediaable_id" type="text" placeholder="ex1obj ID..." />
</div>
<div class="col-xs-2 col-md-2">
<input class="pure-button pure-button-primary pull-right" type="submit" value="Upload">
</div>
{!! Form::close() !!}
and here is the store method in the controller:
if (\Input::hasFile('file'))
...
foreach ($all_uploads as $upload)
{
if ($this->validate_upload($upload))
{
if ($this->move_one_file($upload)==false)
move_one_file:
the main part is:
// move file
try {
$file()->move($targetDir, $Filename);
} catch (Exception $e) {
return false;
}
thanks
Unfortunately, I still can't fully tell what's going on, but I would guess that your error is coming from this line:
$file()->move($targetDir, $Filename);
What does the $file()
method do? If it's not a method and you are just accessing the file, then you would want to do this:
$file->move($targetDir, $Filename);
thanks - that was just a bug...you are right...but it still does not solve the corrupt files :-(
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community