Code Monkey home page Code Monkey logo

yii2-file-kit's People

Contributors

1allen avatar bitsnaps avatar chinaphp avatar chizdrel avatar dungphanxuan avatar eireen avatar ferluk avatar gottafixthat avatar keltstr avatar kharalampidi avatar krissss avatar mehrna avatar rdeanar avatar senguttuvang avatar sircovsw avatar thecodeholic avatar tol17 avatar trancesmile avatar trntv avatar verstoff avatar vkovrizhkin avatar vuongxuongminh avatar xavsio4 avatar xbazilio avatar xxcarleonexx avatar xzaero avatar yanhuixie avatar z1bun avatar zoge avatar ztdan4ik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-file-kit's Issues

Конфликт имён.

Добрый день!
При загрузке файлов на сервер происходит конфликт с названием полей.
В моей модели, куда я подгружаю картинку, существуют поля: name, type.

array (size=3)
  '_csrf' => string 'ZlIzYXpGMFYQJVozTgN.FSNraVZOB18cFz9RIkwfBCMpOGIISHBAAg==' (length=56)
  'Company' => 
    array (size=13)
      'type' => string '2' (length=1)
      'name' => string '23423432' (length=8)
      'picture' => 
        array (size=6)
          'path' => string '1/WMi3_hcCuNvxd3RqX_AYfM2inifNRdBZ.png' (length=38)
          'name' => string ' экрана_2015-04-29_00-44-43' (length=33)
          'size' => string '465063' (length=6)
          'type' => string 'image/png' (length=9)
          'order' => string '' (length=0)
          'base_url' => string 'http://storage.maritime.dev/source' (length=34)
      'phone' => string '' (length=0)
      'email' => string '[email protected]' (length=19)
      'skype' => string '' (length=0)
      'site' => string '' (length=0)
      'city_id' => string '' (length=0)
      'country_id' => string '' (length=0)
      'adress' => string '' (length=0)
      'text' => string '' (length=0)
      'created_by' => string '1' (length=1)
      'contact_person' => string '' (length=0)
  '_fileinput_w1' => string '' (length=0)

При сохранении модели эти поля заполняются из данных о загруженном файле. Содержимое Company['picture']['name'] заменяет содержимое Company['name'], с Type та же проблема..

File names are cut, when uploading

Examle file name "Форма 7 - Дополнительный сервис Имя сервиса" cut to "7 - Дополнительный сервис Имя сервиса" after upload

Messages error

The message file for category 'app' does not exist: /usr/share/nginx/application/common/messages/es-CL/app.php Fallback file does not exist as well: /usr/share/nginx/application/common/messages/es/app.php
/usr/share/nginx/application/vendor/trntv/yii2-file-kit/src/widget/Upload.php (97)
/usr/share/nginx/application/backend/views/some-view/_form.php (48)
/usr/share/nginx/application/backend/views/some-view/update.php (19)

The problem is in this lines, because, at least in my application, the app messages category doesn't exist.

If I'm not wrong translations should be kept in a sepparate messages folder.

Have a nice day!

How to specify path and base url for each attribute in upload behaviour

   /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
            TimestampBehavior::className(),
            [
                'class' => SluggableBehavior::className(),
                'attribute' => 'name',
            ],
            [
                'class' => UploadBehavior::className(),
                'attribute' => 'on_image',
                'pathAttribute' => 'on_image_path',
                'baseUrlAttribute' => 'on_image_base_url',
            ],
            [
                'class' => UploadBehavior::className(),
                'attribute' => 'off_image',
                'pathAttribute' => 'off_image_path',
                'baseUrlAttribute' => 'off_image_base_url',
            ],
        ];

    }

i want to store in different directory.
for on_image to @storage/web/product/on_images,
off_image to @storage/web/product/off_images

file upload using AWS

{"name":"PHP Warning","message":"fclose(): 13 is not a valid stream resource","code":2,"type":"yii\base\ErrorException","file":"/var/www/html/goodwin-brothers/components/filesystem/StorageEngine.php","line":101,"stack-trace":["#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'fclose(): 13 is...', '/var/www/html/g...', 101, Array)","#1 /var/www/html/goodwin-brothers/components/filesystem/StorageEngine.php(101): fclose(Resource id #13)","#2 /var/www/html/goodwin-brothers/vendor/trntv/yii2-file-kit/src/actions/UploadAction.php(124): app\components\filesystem\StorageEngine->save(Object(yii\web\UploadedFile))","#3 [internal function]: trntv\filekit\actions\UploadAction->run()","#4 /var/www/html/goodwin-brothers/vendor/yiisoft/yii2/base/Action.php(92): call_user_func_array(Array, Array)","#5 /var/www/html/goodwin-brothers/vendor/yiisoft/yii2/base/Controller.php(154): yii\base\Action->runWithParams(Array)","#6 /var/www/html/goodwin-brothers/vendor/yiisoft/yii2/base/Module.php(454): yii\base\Controller->runAction('upload', Array)","#7 /var/www/html/goodwin-brothers/vendor/yiisoft/yii2/web/Application.php(84): yii\base\Module->runAction('file-storage/up...', Array)","#8 /var/www/html/goodwin-brothers/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))","#9 /var/www/html/goodwin-brothers/web/index.php(12): yii\base\Application->run()","#10 {main}"]}

default repository

Default repository should be defined.
Repository routes based on categories

upload relation

How can i use upload relations for junction tables.
it works fine for one to many relation, as you did in backend articles.
But how can i use it for many to many relations.

Не работает в kartik-grid

Не работает виджет при вызове формы в модальном окне (как это устроено в kartik-grid). input file работает как обычный загрузчик файлов в html без удобного интерфейса. В то же время, если попасть на форму без ajax то все работает отлично.

'Upload' not support other languages

The widget Upload uses 'messagesCategory' with language en,but there is no messages/en in yii2-start-kit.

'messages' => [
    'maxNumberOfFiles' => Yii::t($this->messagesCategory, 'Maximum number of files exceeded', [], 'en'),
    'acceptFileTypes' => Yii::t($this->messagesCategory, 'File type not allowed', [], 'en'),
    'maxFileSize' => Yii::t($this->messagesCategory, 'File is too large', [], 'en'),
    'minFileSize' => Yii::t($this->messagesCategory, 'File is too small', [], 'en')
]

Unknown Property "filesystemComponent"

This configuration:

'fileSystem' => [
    'class' => 'creocoder\flysystem\LocalFilesystem',
    'path' => '@webroot/storage'
],
'fileStorage'=> [
    'class' => '\trntv\filekit\Storage',
    'filesystemComponent'=> 'fileSystem',
    'baseUrl' => '/storage',
],

leads to error

$storage = \Yii::$app->get('fileStorage');
Unknown Property – yii\base\UnknownPropertyException
Setting unknown property: trntv\filekit\Storage::filesystemComponent

Storage::$filesystemComponent should be public as well as Storage::$filesystem.

Initial images

It's sad that i can't preload my uploaded to model images in your Upload multiple widget.
So i made a little mod to Upload class:
"public $initial = false",
"if($this->initial){
foreach($this->initial as $ini){
$content .= Html::hiddenInput($this->name, $ini[$this->attribute]);
}
}" in run()

and 'initial'=>$model in view.
it loads images fine, but it's needed to be able to delete images from model.
It would be great if this ability were by default

Image position on second line, when change order

If we have more than 1 line of images, and try to change order of images in second (and more) line, position of image shifts to top.
Add screenshot with this problem. I try to change last image order.
2016-02-17 10-33-25

Just sugestion

I think the base_url should store in config files, do not need store in every db recorder.

file-kit Image Pixelated

Hi Eugene,

Somehow my file upload setup seems to make my small images (mostly about 4kb) pixelated.
I'm not sure if they are processed in any way but what I would really like is that they are not resized at all or processed in any way. How can I achieve that?

Regards and thanks for your help,

Adam


PRESENT CONFIG

         'avatar-upload' => [
            'class' => UploadAction::className(),
            'deleteRoute' => 'avatar-delete',
            'on afterSave' => function ($event) {
                /* @var $file \League\Flysystem\File */
                $file = $event->file;
                $img = ImageManagerStatic::make($file->read())->fit(382, 215);
                $file->put($img->encode());
            }
        ],

PHP Recoverable Error

Don't know what to do

'fs' => [
'class' => 'creocoder\flysystem\LocalFilesystem',
'path' => '@backend/uploads'
],
'fileStorage' => [
'class' => 'trntv\filekit\Storage',
'baseUrl' => '@backend/uploads',
'filesystemComponent' => 'fs'
],

Error:

{"name":"PHP Recoverable Error","message":"Argument 1 passed to League\Flysystem\Handler::__construct() must implement interface League\Flysystem\FilesystemInterface, instance of creocoder\flysystem\LocalFilesystem given, called in /home/www-data/www/iptool/vendor/trntv/yii2-file-kit/src/actions/UploadAction.php on line 130 and defined","code":4096,"type":"yii\base\ErrorException","file":"/home/www-data/www/iptool/vendor/league/flysystem/src/Handler.php","line":23,"stack-trace":["#0 /home/www-data/www/iptool/vendor/league/flysystem/src/Handler.php(23): yii\base\ErrorHandler->handleError(4096, 'Argument 1 pass...', '/home/www-data/...', 23, Array)","#1 /home/www-data/www/iptool/vendor/trntv/yii2-file-kit/src/actions/UploadAction.php(130): League\Flysystem\Handler->__construct(Object(creocoder\flysystem\LocalFilesystem), '1/Hkgy9UC3yhwhy...')","#2 [internal function]: trntv\filekit\actions\UploadAction->run()","#3 /home/www-data/www/iptool/vendor/yiisoft/yii2/base/Action.php(92): call_user_func_array(Array, Array)","#4 /home/www-data/www/iptool/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\Action->runWithParams(Array)","#5 /home/www-data/www/iptool/vendor/yiisoft/yii2/base/Module.php(455): yii\base\Controller->runAction('upload', Array)","#6 /home/www-data/www/iptool/vendor/yiisoft/yii2/web/Application.php(84): yii\base\Module->runAction('file/upload', Array)","#7 /home/www-data/www/iptool/vendor/yiisoft/yii2/base/Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))","#8 /home/www-data/www/iptool/backend/web/index.php(18): yii\base\Application->run()","#9 {main}"]}

Thanks in advance

vaildationRules and acceptFileType

Hi,
on the file \vendor\trntv\yii2-file-kit\src\widget\Upload.php

I see there attribute for specifying types needed , how can I use this I tried some regular expressions and file types and nothing succeeded .
Also, on \vendor\trntv\yii2-file-kit\src\actions\UploadAction.php
there array for validationRules how I can use it ..
thank you a lot for your contributions in building such kits.
best regards,
Fady

get file model id

Is there any way to get the model id for saved file on fileProcessing?

upload file permission

Hi
Maybe stupid question: how can I set permission for uploading files?
Now it is 600 ( -rw------- ), and I can't see where I can establish the rights clearly.
Please, help

bower-asset/blueimp-file-upload assets not downloaded

I'vr just installed your starter kit package and I couldn't upload images.

I've updated bower-asset/blueimp-file-upload from ~9.7.0 to ~9.10.5 and it works fine now, maybe you should update to a later version as well.

upload file permissions

Hi,
sorry to bother you, but I had simple question about this file kit. I installed the yii starter kit that has this and when I upload a file the permissions are set to 600. The starter kit also has the file manager with it and it does not have this issue. So is there a place to set the upload permissions or is this dependent on my server somehow? What could be causing this?

Thanks

Редирект после загрузки

Каким образом можно корректно сделать редирект на определенный action после загрузки файла на странице вывода виджета. Т.е можно ли передать и как параметр для редиректа аналогично указанию размера файла или его расширения (maxFileSize, acceptFileTypes)?

Yandex.Disk затычка для новых директорий

Адаптер.

        <?php
        /**
         * @author Artem Dekhtyar <[email protected]>
         * 30.09.2015
         */

        namespace common\components\filesystem;

        use League\Flysystem\Filesystem;
        use League\Flysystem\WebDAV\WebDAVAdapter;
        use trntv\filekit\filesystem\FilesystemBuilderInterface;

        /**
         * Class WebDAVFlysystemBuilder
         */
        class WebDAVFlysystemBuilder implements FilesystemBuilderInterface
        {
            public $path;
            public $pathPrefix = '/extweb';

            public function build()
            {

                \yii\base\Event::on(\trntv\filekit\Storage::className(), \trntv\filekit\Storage::EVENT_BEFORE_SAVE, function ($event) {
                    /** @var \trntv\filekit\Storage $storage */
                    $storage = $event->sender;

                    if (!$storage->getFilesystem()->has('.dirindex')) {
                        $storage->getFilesystem()->write('.dirindex', 1);
                        $dirindex = 1;
                    } else {
                        $dirindex = $storage->getFilesystem()->read('.dirindex');
                    }

                    if($storage->maxDirFiles !== -1) {
                        if($storage->getFilesystem()->has($dirindex)) {
                            $filesCount = count($storage->getFilesystem()->listContents($dirindex));
                            if ($filesCount > $storage->maxDirFiles) {
                                $dirindex++;
                                $storage->getFilesystem()->createDir($dirindex);
                            }
                        } else {
                            $storage->getFilesystem()->createDir($dirindex);
                        }
                    }
                });

                $client = new \Sabre\DAV\Client([
                    'baseUri' => 'https://webdav.yandex.ru',
                ]);
                $client->addCurlSetting(CURLOPT_SSL_VERIFYPEER, false);
                $client->addCurlSetting(CURLOPT_HTTPHEADER, [
                    'Authorization: OAuth TOKENTOKENTOKEN', // https://tech.yandex.ru/disk/doc/dg/concepts/quickstart-docpage/
                    'Accept: */*',
                    'Host: webdav.yandex.ru'
                ]);

                $adapter = new WebDAVAdapter($client, '/');
                $flysystem = new Filesystem($adapter);

                if (!$flysystem->has($this->pathPrefix)) {
                    $flysystem->createDir($this->pathPrefix);
                }
                $adapter->setPathPrefix($this->pathPrefix);

                return $flysystem;
            }
        }

И, на всякий случай, Sabre\HTTP\Client::createCurlSettingsArray() стр.426 портит установленые из вне хидеры. Но может, я в чём то не разобрался.

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.