1

I am using this plugin: http://hayageek.com/docs/jquery-upload-file.php on my site.

It is working nice, but I need to reload page after successful upload. There is some Callback afterUploadAll which maybe can do it, but I don´t know how to implement it.

Here is my code, how can I add it to that?:

<h1>Header</h1>
<div class="wrapper">
<div id="uploader">Upload</div>
</div>

<script>
$(document).ready(function()
{
    $("#uploader").uploadFile({
    url:"upload.php",
    fileName:"myfile",
    showDone:true,
    maxFileSize: 20971520,
    showFileCounter: false,
    }); 
</script>
1
  • If you're giving the file to a PHP script, isn't it therefore POSTing? Implying a forced reload. Commented Feb 7, 2017 at 14:58

2 Answers 2

1
<script>
$(document).ready(function()
{
$("#uploader").uploadFile({
url:"upload.php",
fileName:"myfile",
showDone:true,
maxFileSize: 20971520,
showFileCounter: false,
afterUploadAll: function(obj) {
    window.location = 'YOUR URL HERE';
}
}); 

OR

 <script>
   $(document).ready(function()
   {
  $("#uploader").uploadFile({
url:"upload.php",
fileName:"myfile",
showDone:true,
maxFileSize: 20971520,
showFileCounter: false,
afterUploadAll: function(obj) {
    location.reload();
}
}); 

Sign up to request clarification or add additional context in comments.

Comments

0

try:

<script>
$(document).ready(function()
{
    $("#uploader").uploadFile({
    url:"upload.php",
    fileName:"myfile",
    showDone:true,
    maxFileSize: 20971520,
    showFileCounter: false,
    afterUploadAll: function(obj) {
        window.location = 'http://www.example.de';
    }
    }); 
</script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.