@shing_shing It looks like the problem is with the way you are trying to open the file. In the first example, you are trying to open the file using the path '/path/to/file' which may not have the correct permissions for the script to read. In the second example, you are trying to use the file_get_contents() function to read the contents of the file, but you are passing it a path to the file instead of a valid file resource.
You can try to use Laravel's Storage facade to store the files and get the correct file path to use in the Guzzle request. For example:
use Illuminate\Support\Facades\Storage;
$path = $request->file('file_name')->store('uploaded_files');
$file = Storage::get($path);
$response = $client->request('POST', $sample_api, [
'headers' => [
'Content-Type' => 'multipart/form-data',
],
'multipart' => [
[
'name' => 'file_name',
'contents' => $file
]
],
]);
It is also important to make sure that your storage directory has the correct permissions for writing. You can check the documentation of Laravel's Storage facade for more information.