JavaScript dropzone.js image upload to different server (cross domain) dropzone image upload in laravel,dropzone image upload in php,

Here is my code to upload image, It is working fine if i give the form action as same server

NOT working if i give action to different server

html :

<div id="dropzone">
                                <form action="http://localhost:8080/stardom/api/v1/image" class="dropzone">
                                    <input type="hidden" name="album_id" value="" id="album_id" />
                                    <div class="fallback">
                                        <input name="file" type="file" multiple="" />
                                    </div>
                                </form>
                            </div>

js :

$(".dropzone").dropzone({
                paramName: "file", // The name that will be used to transfer the file
                maxFilesize: 2, // MB
                acceptedMimeTypes : 'image/*',
                addRemoveLinks : false,
                dictDefaultMessage :
                '<span class="bigger-150 bolder"><i class="icon-caret-right red"></i> Drop files</span> to upload \
                <span class="smaller-80 grey">(or click)</span> <br /> \
                <i class="upload-icon icon-cloud-upload blue icon-3x"></i>'
            ,
                dictResponseError: 'Error while uploading file!',

                //change the previewTemplate to use Bootstrap progress bars
                previewTemplate: "<div class=\"dz-preview dz-file-preview\">\n  <div class=\"dz-details\">\n    <div class=\"dz-filename\"><span data-dz-name></span></div>\n    <div class=\"dz-size\" data-dz-size></div>\n    <img data-dz-thumbnail />\n  </div>\n  <div class=\"progress progress-small progress-success progress-striped active\"><span class=\"bar\" data-dz-uploadprogress></span></div>\n  <div class=\"dz-success-mark\"><span></span></div>\n  <div class=\"dz-error-mark\"><span></span></div>\n  <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n</div>",
                complete : function(){

                    if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
                        loadImages();
                    }

                }
              });

Question : How can i make dropzone.js upload files to different server?

Answer:1

If you are going to be doing anything where ServerA serves the content to Browser and Browser wants to turn and send information to ServerB, and you are doing this via javascript/ajax, you are going to need to tell the receiving ServerB that it should accept data posts from a server it did not just serve to. Usually this is done using Access-Control-Allow-Origin "*" In your .htaccess file.

I have some experience with this, but not a ton. I have used it on internal platform applications where we do not need to worry about XSS. Hope that helps. Sorry its so late.

Answer:2

I have executed e2e test for following code using angular it('should successfully login and create a session using valid credentials', function() { browser.get('http://www.angularjs.org'); ...

I have executed e2e test for following code using angular it('should successfully login and create a session using valid credentials', function() { browser.get('http://www.angularjs.org'); ...

Just trying to wrap my ahead around on this: var _myFn = function(param1, param2) { event.stopPropagation(); // this is what I want = read or affect click event information // do stuff with ...

Just trying to wrap my ahead around on this: var _myFn = function(param1, param2) { event.stopPropagation(); // this is what I want = read or affect click event information // do stuff with ...

  1. access request information event viewer
  2. derby uni access information event

Here I am creating nav menus using div and jquery. I tried few things here but didn't get the result what exactly I want. You can see in a fiddle when I click a link those two scrollbars (x & y) ...

Here I am creating nav menus using div and jquery. I tried few things here but didn't get the result what exactly I want. You can see in a fiddle when I click a link those two scrollbars (x & y) ...

  1. jquery explode effect
  2. jquery explode effect example
  3. jquery explode effect not working
  4. jquery explosion effect
  5. jquery bomb effect
  6. jquery image explode effect
  7. jquery ui explode effect
  8. jquery ui explode effect example
  9. jquery dialog effect explode
  10. jquery.effects.explode.min.js

I'm writing a userscript for my own use on a certain website, which will run in Chrome (since that's my preferred browser). Some of the website's javascript apparently (re)defines console for its own ...

I'm writing a userscript for my own use on a certain website, which will run in Chrome (since that's my preferred browser). Some of the website's javascript apparently (re)defines console for its own ...

  1. how does chrome developer tools work
  2. chrome does not show developer tools