Giter VIP home page Giter VIP logo

Comments (7)

gnello avatar gnello commented on July 25, 2024

Hi,
thanks for pointing out this error, it was very useful for finding a general error on multipart datas that I'll fix soon.
I've just released a fix for your specific case, let me know if it solves.

from php-mattermost-driver.

tuanvucd avatar tuanvucd commented on July 25, 2024

Many thank!. it worked. but can I ask you one more questions?
How can I generate client_ids? The upload File API is required client_ids

from php-mattermost-driver.

tuanvucd avatar tuanvucd commented on July 25, 2024

so I have to change it

    $option = [
        [
            'name' => 'channel_id',
            'contents' => empty($requestOptions['channel_id']) ? null : $requestOptions['channel_id'],
        ],
        [
            'name' => 'files',
            'filename' => empty($requestOptions['filename']) ? null : $requestOptions['filename'],
            'contents' => empty($requestOptions['files']) ? null : $requestOptions['files'],
        ]
    ];

    if (isset($requestOptions['client_ids'])) {
        $option[] = [
            'name'    => 'client_ids',
            'content' => $requestOptions['client_ids']
        ];
    }

    return $this->client->post(self::$endpoint, $option, RequestOptions::MULTIPART);

(client_ids is not required)

from php-mattermost-driver.

gnello avatar gnello commented on July 25, 2024

Hi,
I'm not sure I understood your question, the client_ids param is not required and you can call the uploadFile method without passing it

$result = $driver->getFileModel()->uploadFile([
    'channel_id' => '123bcff45',
    'filename' => 'test.jpg',
    'files' => fopen('/path/to/the/file', 'rb'),
]);

Is there something wrong with this?

from php-mattermost-driver.

tuanvucd avatar tuanvucd commented on July 25, 2024

Yes, It is not required
code
But I get an error
error

from php-mattermost-driver.

gnello avatar gnello commented on July 25, 2024

Oh, you're absolutely right. I'm sorry for this inconvenience.
I've just released the fix, please let me know if you notice anything else.

Thanks.

from php-mattermost-driver.

tuanvucd avatar tuanvucd commented on July 25, 2024

Thank you. It worked perfectly

from php-mattermost-driver.

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.