francimor
francimor

Reputation: 13

jQuery Upload File Plugin - how to reload page after upload?

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>

Upvotes: 1

Views: 685

Answers (2)

DaveOz
DaveOz

Reputation: 98

<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();
}
}); 

Upvotes: 1

user4345221
user4345221

Reputation:

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>

Upvotes: 0

Related Questions