amazon s3 upload using javascript sdk is not working -


I am using javascript Amazon SDK to upload content to Amazon. I try the example. This is my code.

  & lt; Script src = "https://sdk.amazonaws.com/js/aws-sdk-2.0.0-rc13.min js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; // Configure the settings to configure the credentials in the SDK // AWS.config.credentials = ...; AWS.config.update ({accesskeyId: 'keyid', secretAccessKey: 'secretkey'}); // Configure your area AWS.config.region = 'us-west-2'; & Lt; / Script & gt; & Lt; Input type = "file" id = "file-selector" /> & Lt; Button ID = "Upload-Button" & gt; Upload to S3 & lt; / Button & gt; & Lt; Div id = "result" & gt; & Lt; / Div & gt; & Lt; Script type = "text / javascript" & gt; var bucket = new AWS 3 ({Params: {Bucket: 'Bucket_Name'}}); Var filechusar = document.getElementById ('file-selector'); Var button = document.getElementById ('upload-button'); Var result = document.getElementById ('result'); Button.addEventListener ('click', function () {var file = file chooser.files [0]; if (file) {results.innerHTML = ''; var cal_key = file.name; var params = {key: cal_key, ContentType: File.type, body: file}; bucket.putObject (parameter, function (mistake, data) {results.innerHTML = mistake? 'Error!': 'Uploaded' ;;});} other {results. InnerHTML = Nothing to upload. ';}}, False); & Lt; / Script & gt;   

but I got this error

but I got this error

  XMLHttpRequest https: //bucket_name.s3-us not loaded Could -west-2.amazonaws.com/Chrysanthemum.jpg The requested resource 'Access-Control-Permission-Origin' header is not present. Origin 'http: //testing.com' is not allowed for entry   

After some research, I know that this is a cross domain problem but I do not know how it is resolved . This code is taken directly from the Amazon documentation.

It is effectively a corrosion problem Let's examine this part of

This will also be useful :)

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -