Uploading files to server
I want to upload files from the frontend to my server as opposed to AWS S3. I have implemented the code below in my operations.ts file which is in my module's subdirectory under /src:
According to the code above, I expect the files to be uploaded to
personita/app/src/personita/operations.tsimport { fileURLToPath } from 'url'
import path from 'path'
// Get the current file's directory
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
// Navigate to project root (app directory) and create uploads folder there
// From: src/personita/operations.ts
// Up to: src/personita/
// Up to: src/
// Up to: app/
const UPLOAD_DIR = path.join(__dirname, '..', '..', '..', 'uploads')
// Log the path to verify
console.log('Upload directory path:', UPLOAD_DIR)
// Ensure upload directory exists
if (!fs.existsSync(UPLOAD_DIR)) {
fs.mkdirSync(UPLOAD_DIR, { recursive: true })
console.log('Created upload directory:', UPLOAD_DIR)
}According to the code above, I expect the files to be uploaded to
personita/app/uploads however they are being saved in the .wasp directory instead personita/app/.wasp/. How do I fix this?