How to setup file upload from NodeJS/VueJS to another server? - node.js

I've created a VueJS App for file uploading in which it will be my admin panel (For CMS) with NodeJS as back-end. Now I want to upload the files that was passed to the NodeJS and move it to another VueJS App which is going to be my primary website in order for me to access the files locally. How can I do it? Any suggestions or different approach will do.

You have many options on how to move the files to another site.
You could store them in a shared bucket or shared directory between your 2 backends or you could add another route to download that file.
You could configure a cronjob to scp or rsync those files to your target machine.
This is really more of a question of how to sync a directory to some place else.

Related

Store file in a local drive folder using electron or node.js

I create one software in electron. I need to add image upload functionality into it. Uploaded images will store in a local drive(D:// Drive) folder and also on preview time I need to access the same folder so I have not idea it is possible in electron and if yes then how can I do this?
And for an extra thing in the backend, I use nodejs if you have an idea about that thing is possible using node js then also tell me so I can integrate with node js also. just I need to store that images to a particular folder which is in my local drive and I also access that image from my local drive for preview things.
For selecting file to upload trigger event (ex. upload-start) through ipc from render process.
In main process in handler for this event use dialog module and .showOpenDialog() method which will return a path to the file.
Then in main process you can use fs module to work with file: read it, copy, move, rename and write.
And check How do I handle local file uploads in electron?

How to serve images with a dokku application and nginx

I am new with dokku and nginx.
I want to serve images from my server, right now I have an application running in dokku serving me different json from a database. Right now I want to upload files and images and serve that images to the users.
I could find some documentation about dokku persistent storage, to mount a local storage and redirect all the data from the application to that directory.
My question right now is. How can I serve the image to the users? If I user http://app-name.host.com/storage/image-url.jpg it will do the trick?.
Or should I use some configuration from the nginx file to serve the files directly from the server local storage?
Maybe someone could guide me in the right path because I can not find any clear information about that.
Thank you!
You can either:
ship a customized nginx.conf.sigil with your repository to make the external nginx route to the storage directory directly
modify your application to serve it. Most frameworks have this functionality.

Possible to set local folder for automatic file uploads

Bit of a loose question so if it gets marked down I'll remove it.. but..
I'm using Primefaces/Spring/Hibernate for Java server.
My application knows a load of file names I need to upload. Those files are on my local computer. Is it possible to tell the application the root directory of these files, for it to then setup uploads for each of these files without me needing to browse for each file individually?
I assume this is a browser security issue, i.e. the user needs to explicitly state which file the application is allowed to know about etc?
If not I'll have to do it in a local application but I was hoping there was a way a mass upload could be kicked off from the browser by just setting the local directory of the files.
I decided to use the Primefaces uploader, upload all the files in the directory and let the application sort them out once it has them on the server.

How to create or use Local Folder in Azure?

I have a required to download a file from SFTP server and the file downloaded is stored to local folder say "D:\Data\tempData.csv"
I have to read the data from local file and consume in my application for other data manipulation.
This job is created using web hooks scheduler in Azure Web Jobs.
I am unable to download file to azure and then read from there.
Can some one help me to use a location for temp data which is equivalent to "D:\Data\tempData.csv" in local system in the azure environment.
Suggest a place in azure where can I download file and then to read from there.
Thanks in Advance.
What I tried?
Tried using SSH.NET dll to download file from SFTP to local folder
Again to read from local folder to my application
Tried looking at BLOB storage usage, which was not approved Tech Arch.
In an Azure Web App, you can create files anywhere under d:\home (for persistent files) or under d:\local (temporary files). See this page for more details on the file system. Try using Kudu Console to see those locations.
How you get the file in that location sounds mostly unrelated to your primary question about what location you can use.
In Azure Environment, the "Web-Jobs" are stored in its local folder where known as "D:\home" and "D:\local" is the local folder used by the Web-hooks.
I was in need to use a folder for temporary usage of downloading a file from SFTP server and again read the file from that local temporary location file and consume it in my application.
I have used the "D:\local\Temp" as the temporary folder which is created by the code after checking the folder existence, then after creating the folder the code will download a file from server and store to this location and then read from the same location and delete the file from that temporary folder.
Thanks all for your help, #David Ebbo Thanks.

AWS to host assets and client side static code at central repository which should be accessible from node to upload files to central location

I am using AWS to run my application based on MEAN stack. I am using load balancer with three instances of Node application servers and three instances of mongo database server on cluster. My application has feature to upload file contents to server, mainly images, audios, vidoes etc. I want following
I want to create one central content repository which should be accessible from all of my three node application servers so that my node code should be able to upload files to central content repository.
I want to one URL to access this central content repository which can be used on user interface to load assets and display it
I also want to re-purpose this same central repository to host all of my client side javascript, css, images and would like my index.html to refer client side assets from central repository URL
I was looking into options in AWS however go confused. Not able to understand what is best and easy approach. Following is server architecture for reference.
Please advice
I couldn't figure out to use EC2 to solve this problem, so I changed my implementation approach, rather than hosting files on file system, I am using the MongoDB GridFS to store files. It helped to make it available for each nodejs hosts.

Resources