Simple Ajax Uploader - FAQ

1. I'm getting error message "Upload directory is not writable."

This means that your upload directory either (a) does not exist, or (b) is not writable (usually because of incorrect permissions). Verify that the directory exists, and then check its permissions to ensure it can be written to.

2. The uploaded files are not in the PHP $_FILES array.

By default, files are uploaded by POST method as raw form data in compatible browsers. To use regular, multipart form uploads for all browsers, set multipart: true in your Javascript options.

3. How do I send custom data to the server?

Use the setData() method inside of the onSubmit() callback function. setData() allows you to dynamically set the data option. For example:

var uploader = new ss.SimpleUpload({
    button: someBtn,
    url: '/uploadUrl',
    
    // Other options...

    onSubmit: function() {
            var self = this;
            self.setData({
                myParam: 'Parameter value' // $_REQUEST['myParam']
            });
        }
});          

4. The onComplete() callback is not firing (or, onError() is firing), even though the server is returning a 200 OK response.

This is usually when the responseType option is set to json, but the server is not returning valid JSON. To check, set the debug option to true to view the server response in the console. Note that a blank or empty response is NOT valid JSON.

5. How do I manually trigger an upload?

Use the submit() method. For example:

var uploader = new ss.SimpleUpload({
    button: someBtn,
    url: '/uploadUrl',
    autoSubmit: false
    
    // Other options...
});

$('#my_submit_btn').on('click', function( e ) {
    e.preventDefault();
    uploader.submit(); // Submit upload when #my_submit_btn is clicked
});

6. Query string params are being added to the upload URL. How can I remove them?

Set the option noParams: true in your Javascript options.

7. My upload button is in a scrolling element or is otherwise "floating" around the page.

Use the updatePosition() method to reset the position of the floating file input.

Here is an example of the problem: https://jsfiddle.net/kgxaj4t9/ (credit: NaWer)
And the fix: https://jsfiddle.net/14abx1yj/2/

8. My problem is not listed here.

Try setting debug: true in your Javascript options to view debug info and server responses in the console.

You can also check the issues tracker in Github. If you believe your problem is the result of a bug, please submit an issue after verifying that a duplicate does not exist.