im using flow.js to upload files to the server, at the moment i am uploading just a single file and check on my upload route if i get the file i send.
So in the angular side i have somehing like this:
<div class="container">
<h1>flow image example</h1>
<hr class="soften"/>
<div>
<div class="thumbnail" ng-hide="$flow.files.length">
<img src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&text=no+image" />
</div>
<div class="thumbnail" ng-show="$flow.files.length">
<img flow-img="$flow.files[0]" />
</div>
<div>
<span class="btn btn-primary" ng-hide="$flow.files.length" flow-btn flow-attrs="{accept:'image/*'}">Select image</span>
<span class="btn btn-primary" ng-show="$flow.files.length" flow-btn flow-attrs="{accept:'image/*'}">Change</span>
<span class="btn btn-danger" ng-show="$flow.files.length"
ng-click="$flow.cancel()">
Remove
</span>
</div>
<p>
Only PNG,GIF,JPG files allowed.
</p>
</div>
</div>
i injected the ng-flow module without problems and then in my angular controller side i use the app.config like this:
app.config(['flowFactoryProvider', function (flowFactoryProvider) {
flowFactoryProvider.defaults = {
target: 'http://localhost:8080/upload',
permanentErrors: [404, 500, 501],
maxChunkRetries: 1,
chunkRetryInterval: 5000,
simultaneousUploads: 4
};
flowFactoryProvider.on('catchAll', function (event) {
console.log('catchAll', arguments);
});
// Can be used with different implementations of Flow.js
// flowFactoryProvider.factory = fustyFlowFactory;
}]);
it feels that this side is working atleast, because i get a error from the server side, this is the error i get:
GET http://localhost:8080/upload?flowChunkNumber=1&flowChunkSize=1048576&flowCu…-1692jpg&flowFilename=1692.jpg&flowRelativePath=1692.jpg&flowTotalChunks=1 404 (Not Found)
and finally i got this in my router
router.post('/upload',multipartMiddleware ,function (req, res) {
flow.post(req, function(status, filename, original_filename, identifier) {
console.log('POST', status, original_filename, identifier);
if (ACCESS_CONTROLL_ALLOW_ORIGIN) {
res.header("Access-Control-Allow-Origin", "*");
}
res.status(status).send();
});
});
if someone can give me a tipe why it fail i appreciate a lot :D
Seem to be making GET request to POST endpoint.