ya carga archivos, ahora hay que hacer que los transforme
							parent
							
								
									03695f71f4
								
							
						
					
					
						commit
						98c010b51c
					
				@ -1,3 +1,3 @@
 | 
			
		||||
// since there's no dynamic data here, we can prerender
 | 
			
		||||
// it so that it gets served as a static asset in production
 | 
			
		||||
export const prerender = true;
 | 
			
		||||
// export const prerender = true;
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,16 @@
 | 
			
		||||
import { writeFile } from 'node:fs/promises';
 | 
			
		||||
 | 
			
		||||
/** @type {import('./$types').Actions} */
 | 
			
		||||
export const actions = {
 | 
			
		||||
	default: async ({ request }) => {
 | 
			
		||||
		const formData = await request.formData();
 | 
			
		||||
		const uploadedFile = formData?.get('file');
 | 
			
		||||
		console.log(uploadedFile);
 | 
			
		||||
		const filename = `./static/uploads/${crypto.randomUUID()}-${uploadedFile?.name}`;
 | 
			
		||||
		await writeFile(filename, Buffer.from(await uploadedFile?.arrayBuffer()));
 | 
			
		||||
		// Bun.writeFile(filename, await uploadedFile?.arrayBuffer());
 | 
			
		||||
 | 
			
		||||
		return { success: true };
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue