Skip to content

🎥 Make videos programmatically with React

report page

Jonny Burgerd22683d72368
diff --git a/packages/convert/app/lib/upload-report.ts b/packages/convert/app/lib/upload-report.ts
new file mode 100644
index 0000000000..4aa31f8e56
--- /dev/null
+++ b/packages/convert/app/lib/upload-report.ts
@@ -0,0 +1,14 @@
+export const handleDrop = async (file: File) => {
+ const presignedResponse = await fetch('https://www.remotion.pro/api/upload', {
+ method: 'POST',
+ body: JSON.stringify({
+ size: file.size,
+ contentType: file.type,
+ }),
+ headers: {
+ 'content-type': 'application/json',
+ },
+ });
+ const json = await presignedResponse.json();
+ console.log(json);
+};
diff --git a/packages/convert/app/routes/report._index.tsx b/packages/convert/app/routes/report._index.tsx
new file mode 100644
index 0000000000..74688eceea
--- /dev/null
+++ b/packages/convert/app/routes/report._index.tsx
@@ -0,0 +1,24 @@
+import React, {useCallback} from 'react';
+import {handleDrop} from '~/lib/upload-report';
+
+const Report: React.FC = () => {
+ const onDrop: React.DragEventHandler = useCallback(async (e) => {
+ const firstItem = e.dataTransfer?.files?.[0];
+ if (!firstItem) {
+ return;
+ }
+
+ e.preventDefault();
+
+ await handleDrop(firstItem);
+ }, []);
+
+ return (
+ <div>
+ <input onDrop={onDrop} type="text" placeholder="Video URL" />
+ <h1>Report a video</h1>
+ </div>
+ );
+};
+
+export default Report;