I´m trying to integrate a Blueimp Jquery File Upload plugin in my application. My application has an AngularJS front-end running in a Node.js server and a Rails API backend running in a WEBrick server. My first question to clarify would be which is the best approach to store the files? in Angular Node.js server or the Rails one.
So far, I´m trying to upload the files to my Node.js server (Angular), so I´m trying to follow Using jQuery File Upload (UI version) with Node.js in https://github.com/blueimp/jQuery-File-Upload/wiki/Setup but it´s not working for me. I think I have not installed the upload service properly, so let me tell you what I did:
npm install blueimp-file-upload-node
Comments: Where should I install this module? In an specific folder? I installed wherever folder (outside of my Angular app scope). Is this ok?./node_modules/blueimp-file-upload-node/server.js Comments: I run the script, and it´s like my shell keeps listening, however I don´t see any log or trace, I just see a new blank line. Is this correct? When I run my node.js server to run my Angular app I see a line like:
Http Server running at http://myserver:1234/
.I try to upload a file, so I configured the form action to:
<form id="fileupload" action="//myserver:8888/upload" method="POST" enctype="multipart/form-data" data-ng-app="demo" data-ng-controller="DemoFileUploadController" data-file-upload="options" data-ng-class="{'fileupload-processing': processing() || loadingFiles}">
I click on "add files" button, and a dialog to choose my file opens. When I click on start upload button, I can see two requests in Chrome: First, an OPTIONS request (200 OK) and second a POST that fails.
In the module server console I can see next error (so, I guess it´s listening):
C:\pruebaGit\node_modules\blueimp-file-upload-node>node server.js
fs.js:543
return binding.rename(pathModule._makeLong(oldPath),
^
Error: ENOENT, no such file or directory 'C:\pruebaGit\node_modules\blueimp-file
-upload-node\tmp\b3c0007b97f016fa6588fdc317258fe6'
at Object.fs.renameSync (fs.js:543:18)
at IncomingForm.<anonymous> (C:\pruebaGit\node_modules\blueimp-file-upload-n
ode\server.js:244:16)
at IncomingForm.EventEmitter.emit (events.js:98:17)
at C:\pruebaGit\node_modules\blueimp-file-upload-node\node_modules\formidabl
e\lib\incoming_form.js:210:12
at WriteStream.<anonymous> (C:\pruebaGit\node_modules\blueimp-file-upload-no
de\node_modules\formidable\lib\file.js:70:5)
at WriteStream.g (events.js:175:14)
at WriteStream.EventEmitter.emit (events.js:117:20)
at finishMaybe (_stream_writable.js:354:12)
at afterWrite (_stream_writable.js:274:5)
at onwrite (_stream_writable.js:264:7)
However in this path: C:\pruebaGit\node_modules\blueimp-file -upload-node\tmp\b3c0007b97f016fa6588fdc317258fe6 I can see the tmp file, even I can open it and see the picture.
What is wrong?
Thanks, Roberto.