I am trying to implement an angular directive for uploading files - here is the directive.
Everything seems to be working fine except I am getting this error:
NetworkError: 404 Not Found - http://localhost:9000/upload.php
I am using the same upload.php
file as is in the examples folder of the directive's github repo.
I have tried a few things - including using relative and absolute paths...as well as trying a few different places to put upload.php
. I realize that Apache handles php stuff so I tried putting upload.php
in the folder that Apache knows to look for php files on my computer (when it needs to execute them in the browser) - and then referenced that location absolutely in the angular files - but that didn't seem to work either. I also tried using grunt-php
- not sure if I set that up correctly but that didn't seem to do anything either.
More specifically - the error occurs on a POST
call, I have found a few things saying that Angular with PHP and post calls can be tricky but I have not been able to put the pieces together myself.
Here is the code in the angular controller that references upload.php
:
var uploader = $scope.uploader = new FileUploader({
url: 'upload.php'
});
I have the upload.php file in the same folder as the controller.
How can I make angular correctly detect upload.php
?
UPDATE
I was using the yeoman angular-fullstack
generator and I found another generator (angular-php
) which is basically the same thing with built in functionality for PHP. I tried using it and I am still getting the same problem...now I have upload.php
in the api
folder of the seed (where I think it is supposed to go) - you can find the seed here. I am still getting the same error however...but I think I should probably use the angular-php
seed instead of the angular-fullstack
seed. Any help would be appreciated.