WAMP forbidden 403 when downloading a file via AJAX

0

When trying to download a file via ajax, apache is returning me forbidden 403, apparently that error is due to the privileges of the folder.

js ajax request

function Ajax() {
    "use strict";
    var operacion = 'BackupDB';
    $.ajax({
        type: 'GET',
        url: '../logica/backup-restore.logic.php?operacion='+operacion,
        cache: false,
        beforeSend: function() {
            $('button[name=BtnBackUp]').text(' Generando...').prepend('<i class="fa fa-gear fa-spin"></i>');
        },
        success: function(data) {
            if (data) {
                window.location.assign('../backup/'+data);
                toastr.success('Respaldo Generado con Exito!.');
            } else {
                toastr.error('Error al Generar Respaldo :( .');
            }
        },
        complete: function() {
            $('button[name=BtnBackUp]').text(' Generar').prepend('<i class="fa fa-download fa-lg"></i>');
        }
    });
    return false;
}

As you can see, a window.loacation.assign () is done to point the address of the file to be downloaded.

    
asked by Christian Gimenez 05.07.2016 в 19:33
source

2 answers

0

Edit the phpmyadmin.conf file:

Get in C: /wamp/alias/phpmyadmin.conf and replace at the end:

Order deny,allow
Deny from all
Allow from 127.0.0.1

replace with:

Order allow,deny
Allow from all

And in the httpd.conf file, which is located in C: \ wamp \ bin \ apache \ Apache2.2.21 \ conf \ httpd.conf , replace the code:

AllowOverride None
Order deny,allow
Deny from all
por el siguiente:

AllowOverride All
Order allow,deny
Allow from all

After making those changes, restart WAMP.

    
answered by 05.07.2016 в 19:41
0
  • Left click on the WAMP icon next to the clock.
  • Locate in Apache.
  • Go to Alias directories
  • Select your folder, example link
  • Select Edit Alias
  • Everything inside replaces it with these lines.

    Alias /miAlias/ "c:/wamp/www/tuCarpeta/" 
    
    <Directory "c:/wamp/www/tuCarpeta/">
      Options Indexes FollowSymLinks MultiViews
      AllowOverride all
      Require all granted
    </Directory>
    

    Maybe it differs in the routes, but it is the same ideology. I hope it helps you. You must have already created the alias, if you do not know how, answer:)

        
    answered by 04.09.2016 в 01:42