Open thangnt-savvy opened 2 years ago
Hi there, we got to work with pre-signed URLs. The change needed is to send it with PUT and type 'raw'.
@anyb1s right I also using pre-signed URL with some configurations but it only seems like work in simulators any ideas why is not working on the real devices
Hi there, we got to work with pre-signed URLs. The change needed is to send it with PUT and type 'raw'.
Hi,
I am having the same problem. @anyb1s ,
if I use type 'raw' I get an error that I cannot pass extra parameters:
Error: Parameters supported only in multipart type
How did you make it work on your side? I need to send the parameters that contain the amazon policies and so on to make the pre-signed URL work. Thanks!
What we do is the following we have an endpoint to presign `$command = $adapter->getClient()->getCommand('putObject', array_filter([ 'Bucket' => $adapter->getBucket(), 'Key' => $path, 'ACL' => 'public-read', 'ContentType' => $request->get('type'), 'Metadata' => [ 'content-type' => $request->get('type'), ] ]));
$signedRequest = $adapter->getClient()->createPresignedRequest($command, '+5 minutes');
return response()->json([
'method' => $signedRequest->getMethod(),
'url' => (string)$signedRequest->getUri(),
'fields' => [],
'path' => 'tmp/' . $filename,
'headers' => [
'content-type' => $request->get('type'),
],
]);`
const options = { url: presignResponse.url, path: imagePath, method: presignResponse.method, type: 'raw', field: 'file', maxRetries: 2, // set retry count (Android only). Default 2 headers: { 'content-type': mimeType, // Customize content-type accept: 'application/json', // Customize content-type }, // Below are options only supported on Android notification: { enabled: true, autoclear: true, onProgressTitle: 'Uploading...', onCompleteTitle: 'Upload finished', }, useUtf8Charset: true, };
I tried to upload a file directly to S3, but my order of parameters is not as required. Seem I can't change the order of my request.
Here is my code
and S3 error message Key should be the first item instead of file