Giter Site home page Giter Site logo

Comments (6)

trntv avatar trntv commented on August 24, 2024

You can create your own flysystem builder class.
I'll update docs as soon as possible

from yii2-file-kit.

trntv avatar trntv commented on August 24, 2024

https://github.com/trntv/yii2-file-kit/blob/master/README.md#using-filesystem-builder

from yii2-file-kit.

iadj avatar iadj commented on August 24, 2024

Awesome. Thank you for the examples!

from yii2-file-kit.

iadj avatar iadj commented on August 24, 2024

@trntv I still get the same error as described in yii-starter-kit/yii2-starter-kit#371:

fstat() expects parameter 1 to be resource, integer given.

Using AwsS3v3FlysystemBuilder from the examples: https://github.com/trntv/yii2-file-kit/blob/master/examples/AwsS3v3FlysystemBuilder.php

from yii2-file-kit.

trntv avatar trntv commented on August 24, 2024

update package
0cdc678

from yii2-file-kit.

iadj avatar iadj commented on August 24, 2024

@trntv Ok, the error is now:

fstat() expects parameter 1 to be resource, object given.
file: "D:\app\vendor\league\flysystem\src\Util.php"
line: 254

Am I doing something wrong? This is my Storage config:

    'fileStorage' => [
        'class' => '\trntv\filekit\Storage',
        'baseUrl' => '  https://s3.amazonaws.com/' . getenv('S3_PROFILE_BUCKET'),
        'filesystem' => [
          'class' => 'common\components\filesystem\AwsS3v3FlysystemBuilder',
          'key'=>getenv('S3_KEY'),
          'secret'=>getenv('S3_SECRET'),
          'region' => 'us-east-1',
        ],

        'as log' => [
            'class' => 'common\behaviors\FileStorageLogBehavior',
            'component' => 'fileStorage'
        ]

AwsS3v3FlysystemBuilder is like the example.

I can see the file is uploaded to the bucket and correctly added to file_storage_item. However the 'upload process' in yii2-starter-kit never seems to finish, and returns the error described above.

Here's a stack trace:

0: "#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'fstat() expects...', 'D:\\app...', 254, Array)"
1: "#1 D:\app\vendor\league\flysystem\src\Util.php(254): fstat(Object(Intervention\Image\Image))"
2: "#2 D:\app\vendor\league\flysystem-aws-s3-v3\src\AwsS3Adapter.php(557): League\Flysystem\Util::getStreamSize(Object(Intervention\Image\Image))"
3: "#3 D:\app\vendor\league\flysystem-aws-s3-v3\src\AwsS3Adapter.php(121): League\Flysystem\AwsS3v3\AwsS3Adapter->upload('1/cD84EtMmnB6CW...', Object(Intervention\Image\Image), Object(League\Flysystem\Config))"
4: "#4 D:\app\vendor\league\flysystem\src\Filesystem.php(96): League\Flysystem\AwsS3v3\AwsS3Adapter->update('1/cD84EtMmnB6CW...', Object(Intervention\Image\Image), Object(League\Flysystem\Config))"
5: "#5 D:\app\vendor\league\flysystem\src\File.php(94): League\Flysystem\Filesystem->put('1/cD84EtMmnB6CW...', Object(Intervention\Image\Image))"
6: "#6 D:\app\frontend\modules\user\controllers\DefaultController.php(41): League\Flysystem\File->put(Object(Intervention\Image\Image))"
7: "#7 [internal function]: frontend\modules\user\controllers\DefaultController->frontend\modules\user\controllers\{closure}(Object(trntv\filekit\events\UploadEvent))"
8: "#8 D:\app\vendor\yiisoft\yii2\base\Component.php(541): call_user_func(Object(Closure), Object(trntv\filekit\events\UploadEvent))"
9: "#9 D:\app\vendor\trntv\yii2-file-kit\src\actions\UploadAction.php(167): yii\base\Component->trigger('afterSave', Object(trntv\filekit\events\UploadEvent))"
10: "#10 D:\app\vendor\trntv\yii2-file-kit\src\actions\UploadAction.php(132): trntv\filekit\actions\UploadAction->afterSave('1/cD84EtMmnB6CW...')"
11: "#11 [internal function]: trntv\filekit\actions\UploadAction->run()"
12: "#12 D:\app\vendor\yiisoft\yii2\base\Action.php(92): call_user_func_array(Array, Array)"
13: "#13 D:\app\vendor\yiisoft\yii2\base\Controller.php(154): yii\base\Action->runWithParams(Array)"
14: "#14 D:\app\vendor\yiisoft\yii2\base\Module.php(454): yii\base\Controller->runAction('avatar-upload', Array)"
15: "#15 D:\app\vendor\yiisoft\yii2\web\Application.php(84): yii\base\Module->runAction('user/default/av...', Array)"
16: "#16 D:\app\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))"
17: "#17 D:\app\frontend\web\index.php(22): yii\base\Application->run()"

from yii2-file-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.