So, we have built a file uploader in our application that is working on the local environment. We have the files being uploaded to public/upload and we can read the files using:
http://localhost:3000/upload/filename.extension
Now, when we move the code to production, we use a check:
getUploadPath = function () {
var fs = Npm.require('fs');
var path = Npm.require('path');
var devPath = path.join(process.cwd(),"../../../../../public");
var prodPath = path.join(process.cwd(),"../client/app/");
if (fs.existsSync(devPath)) {
return path.join(devPath,"upload");
}
else {
return path.join(prodPath,"upload");
}
}
Now, this saves the file to {prod_path}/programs/client/app/upload. However, I cannot use the file in the application. What's surprising is all the files that were in local seem to also be present in the same upload folder and are accessible by the application. What am I missing ?