REMINDER
How to save uploaded file in Custom Folder ?
-
Hi Team,
I'm trying to upload my file in custom folder path(uploadsFolder/) rather than default CloudBackEnd's upload folder. Below code is not working.
Please guide me on how to achieve this
My Folder Structure
/
CloudBackEnd
uploadsFolderMy Code
var request = require('request');
var cloudbackend = require('appdrag-cloudbackend');
var appID = process.env.APPID; // Read from environment variables
var APIKey = process.env.APIKEY; // Read from environment variables
cloudbackend.init(APIKey, appID);
exports.handler = (event, context, callback) => {var postedFiles = event["FILES"]; if(postedFiles.length>0){ for(i=0;i<postedFiles.length;i++){ var tmpPath = postedFiles[i]["path"]; var destPath = "uploadsFolder/"+ tmpPath; cloudbackend.fileSaveUploaded(tmpPath,destPath).then(callback(null, destPath)); } // end -for } else { callback(null, postedFiles.length); }
}; // end - handler
-
Hey Vinoth,
indeed you can write only inside /CloudBackend/uploads/
But there you can write subfolders and filesyour code above will write in /CloudBackend/uploads/uploadsFolder/"+ tmpPath
We might add later an option to be able to write at the root folder (/)
-
Thanks Joseph. Also i have another doubt. What's the max file size we can upload in CloudBackEnd ?
I tried to upload a file size of 55 mb. It doesn't worked.