Support the ongoing development of Laravel.io →
posted 8 years ago
Requests
Last updated 1 year ago.
0

Can you provide us with the code on how you are uploading it?

0

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

0

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);
Last updated 8 years ago.
0

thanks - that was just a bug...you are right...but it still does not solve the corrupt files :-(

0

How is the file corrupt?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

tamirh67 tamirh67 Joined 24 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.