CreativeDream / php-uploader

PHP File Uploader is an easy to use, hi-performance File Upload Script which allows you to upload files to webserver
MIT License
94 stars 51 forks source link

Setting Different Upload Button using Asp.net application. #9

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hello Admin,

I am trying to integrate your library into my asp.net application but finding some issues can you please help me to resolve my issue.

  1. How can I set a different upload button ? using this property addMore: true it directly upload the file on the server asynchronously but we have a separate button where we need to upload files ?
 <form method="post" enctype="multipart/form-data">
            <input type="file" name="files[]" id="demo-fileInput-5" data-jfiler-limit="3" multiple="multiple" />
            <input type="submit" name="btnSubmit" id="btnSubmit" class="btn-custom green" value="Submit" />
            <input type="submit" name="btnCancel" id="btnCancel" class="btn-custom green" value="Reset" />
        </form>
$('#demo-fileInput-5').filer({
    limit: 3,
    maxSize: 100,
    extensions: ['jpg', 'jpeg', 'png', 'gif', 'pdf'],
    changeInput: true,
    showThumbs: false,
    addMore: false
    }
});
$('#btnSubmit').click(function () {

    var filerKit = $("#demo-fileInput-5").prop("jFiler");
    filerKit.options.uploadFile = {
        url: 'Handler.ashx',
        data: null, //Data to be sent to the server {Object}
        type: 'POST',
        enctype: 'multipart/form-data',
        synchron: false, //Upload synchron the files
        beforeSend: null, //A pre-request callback function {Function}
        success: null, //A function to be called if the request succeeds {Function}
        error: null, //A function to be called if the request fails {Function}
        statusCode: null, //An object of numeric HTTP codes {Object}
        onProgress: null, //A function called while uploading file with progress percentage {Function}
        onComplete: null
    };

    filerKit.retry();
    return false;
});
$('#btnCancel').click(function () {
    var filerKit = $("#demo-fileInput-5").prop("jFiler");
    filerKit.reset();
    return false;
});
CreativeDream commented 7 years ago

@rahuljain257 I think you are on the wrong way. Why do you need uploadFile option? You can only use $('#btnSubmit').click(function () { $.ajax(...) })