How change image name before save in folder


i am saving a image but i want rename her before save. How i can do it?


when using ‘move’ function on file, give it name like this:

await profilePic.move(Helpers.tmpPath('uploads'), {name: 'my-photo.jpg'})

For example, if we make form with action \upload’ (dont forget about csrf field! see doc), all we need to add in controller:

async upload ({request, response}) {
const uplFile = request.file('uploaded')
		await uplFile.move('public/upload', {name: 'newfile.jpg'})
		if (!uplFile.moved()) {
			return uplFile.error()
		return "File moved"

File will be moved in ‘upload’ folder in our ‘public’