Bynder / bynder-php-sdk

SDK in PHP for integration with Bynder
MIT License
14 stars 22 forks source link

Enable original filename parameter #47

Open nyroDev opened 3 years ago

nyroDev commented 3 years ago

According to the documentation, an original_filename could be used when uploading a file.
Without it, the full path of the file is used and then shown to the end user, which is not great.

This PR simply enable the parameter to be used when saving the uploaded file as documented.

noofaq commented 3 years ago

I was just wondering what I am doing wrong.

I upvote the pull request as I would also need to do the same fix

TimBloembergen commented 3 years ago

@nyroDev Sorry for the late response on this issue. I've ran some tests with the sample that we include in the SDK and I wasn't able to reproduce the issue that you mention. On these lines https://github.com/Bynder/bynder-php-sdk/blob/8838ecaa7da43c2820bfd36c344d505948d190ae/sample/sample.php#L123-L129

When passing the data as below, the name of the asset gets set as "PHP SDK Upload", the filepath isn't used within the DAM.

    $data = [
        // Will need to create this file for successful test call
        'filePath' => 'sample/image.png',
        'brandId' => $brandsList[0]['id'],
        'name' => 'PHP SDK Upload',
        'description' => 'SDK upload'
    ];

The original filename doesn't change the name of the actual file but it adds this as an extra field within the Info Pane on the asset detail page.

nyroDev commented 3 years ago

@TimBloembergen I'm not sure to follow you.

My Pull Request add the documented parameter original_filename that is currently not present in the SDK. On the code you mentionned, you didn't use the original_filename that this PR add.

I understand that regarding final user it won't make many change as the original filename is not used on the DAM side, but for my use case, the original file name is useful for the user as it will give some information on where it comes from.

And it's documented on the API, so why don't support it?

Maybe you want me to also update the sample.php to show how to use the original_filename parameter?

TimBloembergen commented 3 years ago

@nyroDev We can definitely add it as it's part of the API! But it won't solve the issue that you described regarding the filepath being shown to the user. What are you passing as the payload so this happens?

nyroDev commented 3 years ago

It's already part of the API!

My PR just add the necessary in order to use the original_filename documented in the documenation link above.

nyroDev commented 11 months ago

@TimBloembergen I still don't understand what is the problem here.
I'm using this fix for 2 years now without any trouble, I'm enable to specify the filename that will be shown to user, independantly of the filePath used