I am using below code to upload files to S3 with JS. Don't know what's going on wrong here. Any help will be highly appreciated..
request: {
endpoint: "https://photoform.s3.amazonaws.com",
inputName: 'name',
forceMultipart: false,
paramsInBody : true,
filenameParam : 'test',
params: {},
accessKey: "AKIAIM5CBG3WFLLZBTAA"
},
signature: {
//always included
"expiration": "2014-02-04T14:32:31.373Z",
signature : "Bv7MiXh5LM4nQGcK0HVgu27DmQE=",
policy: "eyAiZXhwaXJhdGlvbiI6ICIyMDE0LTAyLTA0VDE0OjMyOjMxLjM3M1oiLCJjb25kaXRpb25zIjogWyB7ImJ1Y2tldCI6ICJwaG90b2Zvcm0iIH0gLHsgImFjbCI6ICJwdWJsaWMtcmVhZCIgfSx7IkNvbnRlbnQtVHlwZSI6ImpwZyJ9LHsic3VjY2Vzc19hY3Rpb25fcmVkaXJlY3QiOiJodHRwczovL2NzMzAuc2FsZXNmb3JjZS5jb20vYXBleC9MaXN0U2xpZGVyVXBsb2FkUGljc1N1Y2Nlc3MifSxbInN0YXJ0cy13aXRoIiwgIiRrZXkiLCAiIl0gXX0=",
"conditions":
[
//always included
{"acl": "public-read"},
//always included
{"bucket": "photoform"},
//not included in IE9 and older or Android 2.3.x and older
{"Content-Type": "jpg"},
//always included
{"key": "AKIAIM5CBG3WFLLZBTAA"},
//always included
{"x-amz-meta-qqfilename": "test.jpg"},
]
},
cors: {
expected: true, //all requests are expected to be cross-domain requests
sendCredentials: false, //if you want cookies to be sent along with the request
allowXdr: true
},
Please read through the documentation on the docs site that explains how to use Fine Uploader S3. The signature option is not where you create your policy document. Instead of hard-coding the policy document and signature in the signature option, you must specify an endpoint where Fine Uploader will send the policy document it creates. Your server is expected to sign it and return the signature.
Useful links:
Creating a server for Fine Uploader s3
Fine Uploader S3 signature option
Related
I have been able to successfully create and receive webhook events for files in my personal drive, how ever when I try to set them up for a file in a shared drive I receive no events.
I get a status 200 when creating the webhook. So it seems that the webhook for file in the shared drive is being created properly. But after the initial 200 response no events follow no matter which changes to the file are made.
below is the request I have been using.
Perhaps this is a permissions issues but I can't find anything in Google's documentation on how to support push notifications in shared drives.
request({
method: 'POST',
uri:`https://www.googleapis.com/drive/v3/files/{fileId}`,
json: true,
body: {
id: '',
type: 'web_hook',
address: ``,
expiration: expiration_date,
},
headers: { Authorization: `Bearer` },
qs: {
includeItemsFromAllDrives: true,
supportsAllDrives: true,
supportsTeamDrives: true,
},
}),
```
Thanks
I'm trying to use Fine Uploader 5.15.0, set up with multiple file fields & uploader instances (multiple: false is set on each) which all display and select files correctly. They are posting to a custom endpoint that is returning any parameters to me. Uploads are set to happen as soon as the file is selected, and file and QQ parameters are sent okay.
My problem is when I attempt to send additional data to the server along with the upload.
I have tried including my additional parameters in the endpoint of the request option, and as a params node added to the options variously as follows:
uploaders[1] = new qq.FineUploader({
element: document.getElementById("uploader-1"),
multiple: false,
request: {
endpoint: "default.cfm",
paramsInBody: false,
params: {
act: "action/processFile",
uid: 4747
}
}
})
Calls without any parameters available in either form or URL scopes.
Removing the params section and attempting to pass them via endpoint:
request: { endpoint: "default.cfm?act=action/processFile" }
Works fine, but obviously no additional parameters.
request: { endpoint: "default.cfm?act=action/processFile&uid=4747" }
Calls without any URL parameters.
request: { endpoint: "default.cfm?act=action/processFile&uid=4747" }
Calls with "act" available, but all others have their ampersand stripped out, so the parameter name becomes "amp;uid"
According to https://blog.fineuploader.com/include-params-in-the-request-body-or-the-query-string-479ac01cbc63 and other questions on here the first one should work. For the others obviously FineUploader is doing some additional processing on endpoint that is wiping out my parameters.
I'm missing something essential, can anyone educate me?
Thanks!
I am using the param option in the deleteFile settings to send a temporary ID that I use throughout the page
deleteFile: {
enabled: true,
forceConfirm: false,
method: 'POST',
endpoint: 'myendpoint',
params: {tempID: 'MYFIXEDID'}
},
No post value for tempID is passed in the request. The same syntax works ok for the request settings.
This is confirmed as a bug in version 5.3.2. Request has been opened on the issue tracker.
I have left this question and answer here in case others are having the same issue.
I am trying to set the cache control to no-cache on S3 uploads but the header is not being set. I tried the below in the upload script which didn't work.
request: {
endpoint: "https://",
accessKey: "",
customHeaders: "Cache-Control: no-cache"
},
Then I also tried adding it to the S3 handler php file like this ( added to the bottom)
// Only needed in cross-origin setups
function handlePreflight() {
handleCorsRequest();
header('Access-Control-Allow-Methods: POST');
header('Access-Control-Allow-Headers: Content-Type');
header('Access-Control-Allow-Headers: Cache-Control');
plus I thenm also added it here
function signRequest() {
header('Content-Type: application/json');
header('Cache-Control: no-cache');
neither by themselves nor or all of them together made the header appear on uploaded file.
So I am not sure what I am doing wrong
To set custom headers for S3. Use 'request.params' instead of 'request.customHeaders'.
For e.g(in this case try using the below one)
request: {
endpoint: "https://endpoint.url.here",
accessKey: "access-key-here",
params: {"Cache-Control": "no-cache"}
},
To know more refer the docs.
Your last two examples would not have any affect on the object in S3. Instead, they would only influence the response to Fin Uploader's signature request. Your first example is incorrectly formed. The request.customHeaders option expects an object value.
Regardless, you can't currently pass these types of headers on to the S3 object via Fine Uploader S3. See https://github.com/FineUploader/fine-uploader/pull/1258 for details & updates.
I am a beginner at sencha touch2. i am trying to create a some app which contains a blog view. the code of the blog is given below. when i launch the app, the content fails to load, giving these errors. i am using wamp for localhost.
XMLHttpRequest cannot load " http://secureclick-media-maynemyltf.netdna-ssl.com/Extensions/rjs/c2.js". Origin< http://localhost> is not allowed by Access-Control-Allow-Origin.
XMLHttpRequest cannot load " http://api.yontoo.com/GetClientData.ashx?key=null&id=47a8564d-d089-4195-9564-72f107ea1c56&loc=http%3A//localhost/GS/&apps=bestvideodownloader,ezLooker,pagerage,buzzdock,toprelatedtopics,twittube". Origin <http://localhost> is not allowed by Access-Control-Allow-Origin.
Ext.define('GS.view.blog',
{
extend:'Ext.navigation.View',
xtype: 'blogpanel',
config:{
title: 'Blog',
iconCls: 'star',
items:
{
xtype:'list',
itemTpl:'{title}',
store:
{
autoLoad: true,
fields:['title','author','content'],
proxy:
{
type:'jsonp',
url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http://feeds.feedburner.com/SenchaBlog',
reader:
{
type:'json',
rootProperty:'responseData.feed.entries',
}
}
}
}
}
});
You're not calling a JSONP service but a JSON one. You can detect it by calling your URL from your browser and see the content isn't starting by a method call.
So you're not bypassing Cross-Domain protections.
You can't just tell the server you want it to answer in JSONP : it must be ready to make such an answer.
And your browser won't let you access from another domain a server answering in json and not having set a header specifying he accepts this cross-domain request. Read this.
EDIT :
You may call this service using JSONP : you just have to specify a callback at the end of the URL.
In addition to this response format, the protocol also supports a
classic JSON-P style callback which is triggered by specifying a
callback argument, which directs the API to deliver the JSON object as
an argument to the specified callback.
Example from the documentation :
'https://ajax.googleapis.com/ajax/services/feed/find?v=1.0&q=Official%20Google%20Blogs&callback=processResults'