2
I am making an email application using Vuejs and I am in the attachments part, and I want to get the file path because only it is enough for me to send the attachment using nodemailer.
Is there any method I can get the file path I chose to upload as an attachment after uploading it to the server??
This you take in Node, not in front-end. The question is too wide, better you give more details.
– bfavaretto
So, first you have to upload the file, after your application upload, it should return the file path and only at this point, proceed with the programming.
– Bruno Rigolon
Got it @Brunorigolon, and you know where the methods to get the file path after uploading??
– LeonardoEbert
@bfavaretto, I will edit the query to specify more her...
– LeonardoEbert
@bfavaretto, changed a little, if you want to edit too, feel free to...
– LeonardoEbert
To get the file path, you need to get this into the backend. In PHP you have this given in $_FILES, in Node, req.files.upload.path, where req is the variable you name the request. After processing in the backend, you return only the file path in your ajax call. In the ajax call you will receive the file path and proceed with the programming. Take a look at this link: https://scotch.io/tutorials/how-to-handle-file-uploads-in-vue-2. With it you have a good basis to do what you need to do.
– Bruno Rigolon
I understood the logic, in case I would have to upload first, put in a directory on the server, then take the file path and then attach in the email, now I understood how to do, the methods for this I will still find out, but it is possible with a help from Node Fs, add as response the I comment for me to accept it...
– LeonardoEbert
Now that you explained I understood well and I saw that everything was already ready on my server, only need to assign the variable with the path on
attachments[]
nodemailer– LeonardoEbert