I understand that this version of the question has appeared many times, but I can not find the answers to this question in this context.
I use a third-party file hosting service that uses jQuery and gives a successful callback when the file download is complete.
What I want to achieve is a form with text fields along with a file loader that, when you click Submit, launches the download function (and the file starts to load with a progress bar) and waits for a successful callback before starting to submit the form.
I have to admit right away that I'm a complete idiot with jQuery, and that bothers me, so I'm very unsure how to achieve this.
My attempts so far only result in a form that tries to submit immediately when the file is being downloaded.
Function manualuploader.uploadStoredFiles(); created when you click the Download Now button.
The jQuery that launches the file loader looks like this:
<form action="index.php" method="post" enctype="multipart/form-data" id="uploader"> <div id="manual-fine-uploader"></div> <div id="triggerUpload" class="btn btn-primary" style="margin-top: 10px;"> <input type="text" name="textbox" value="Test data"> <input name="test" type="button" value="Upload now"> </div> </form> <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="fineuploader-3.6.3.js"></script> <script> $(document).ready(function() { var manualuploader = new qq.FineUploader({ element: $('#manual-fine-uploader')[0], request: { endpoint: 'uploader.php' }, autoUpload: false, text: { uploadButton: '<i class="icon-plus icon-white"></i> Select Files' } }); $('#triggerUpload').click(function() { manualuploader.uploadStoredFiles(); }); }); </script>
source share