question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

More than one file and/or directory was provided for pinning.

See original GitHub issue

Hello, when I want to send more than one file with Http Client or Guzzle in Laravel, “More than one file and/or directory was provided for pinning.” I am getting this response. What would you suggest I do?

public function client()
{
    return Http::withHeaders([
        'pinata_api_key' => config('services.pinata.key'),
        'pinata_secret_api_key' => config('services.pinata.secret'),
    ])
        ->withUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36")
        ->withToken(config('services.pinata.accessToken'))
        ->baseUrl(
            config('services.pinata.url')
        );
}

public function uploadFiles(array $files = [])
{
    if (count($files) === 0) {
        return [];
    }

    $client = $this->client();
    LazyCollection::make($files)->each(
        fn($file, $key) => $client->attach(
            "file",
            File::get($file),
            basename($file),
            ['mimeType' => 'application/octet-stream']
        )
    );
    
    $response = $client
        ->asMultipart()
        ->connectTimeout(120)
        ->timeout(120)
        ->post('/pinning/pinFileToIPFS');
    return $response->json();
}

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
rommel-pinatacommented, Oct 10, 2022

@bsormagec Usually takes 2 weeks. As soon as is approved and deployed in production, I’ll let you know!

0reactions
rommel-pinatacommented, Nov 11, 2022

@bsormagec This is now supported. let me know if you are able to upload a folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pinFromFS: More than one file and/or directory was provided ...
In the README it is said that pinFromFS works with directories but applying to ./dist directory throws this error: [16:31:03] Error: More than...
Read more >
Pin File or Directory - Pinata Docs
This endpoint will accept a single file or a single directory. The request must include a read stream for the payload in order...
Read more >
Windows 10 Task bar Icon for Word and/or Excel, right click to
Windows 10 Task bar Icon for Word and/or Excel, right click to show recent or pinned files. How do I get the recent...
Read more >
Pinata Listing A Directory of Files : r/ipfs - Reddit
Hello, Using the Pinata API currently, and can't seem to find documentation on how to return the objects within a folder.
Read more >
How to Enable And Use Quick Access In Windows 11
You can just pin it to the Quick Action in File Explorer, and you can access ... It is designed to provide users...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found