tobz.nz
3 months ago

Http::attach() a stream() works, but using a string does not.

Posted 3 months ago by tobz.nz

Hey hey

So I'm using the Http client and attaching a file to the request.

Using a stream works fine as per the docs Http::attach('file', fopen('path-to-file', 'r'))->post('...') However using a string (again as per the docs) does not seem to work Http::attach('file', file_get_contents('path-to-file'))->post('...') The file attachment is not sent in this case - server returns error that no file was sent.

Anyone else had this issue. Is it just me or...?

Please sign in or create an account to participate in this conversation.