Faild cannot Post #214320
Unanswered
LucasCherbuin
asked this question in
Codespaces
Faild cannot Post
#214320
Replies: 3 comments
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
0 replies
This comment was marked as off-topic.
This comment was marked as off-topic.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Bug
Body
Hi Everyone,
I try to configure a files converter app with a type switch selection with a drag and drop
`import React from "react";
import { FileUploader as LibFileUploader } from "react-drag-drop-files";
import { useNavigate } from "react-router-dom";
import Upload from './Upload.js';
export default function DragAndDrop({ types = [], onFileSelected }) {
const normalized = Array.isArray(types) ? types.map(t => String(t).toUpperCase()) : [];
const navigate = useNavigate();
const [loading, setLoading] = React.useState(false);
const [error, setError] = React.useState(null);
const handleChange = React.useCallback(async (incoming) => {
const file = Array.isArray(incoming) ? incoming[0] : incoming;
if (!file) return;
if (typeof onFileSelected === "function") onFileSelected(file);
}, [onFileSelected, navigate]);
return (
{/* pick which uploader you want to render */}
<div style={{ marginTop: 8, fontSize: 13, color: "#666" }}>
{loading ? "Uploading..." :
Accepted: ${normalized.length ? normalized.join(", ") : "none"}}{error && <div style={{ color: "red", marginTop: 8 }}>{error}}
);
} `
the process is, when you upload a file, will go on the next page and there's a error comming
this is the upload.js file
`
export default async function Upload(file) {
if (!file) throw new Error('No file provided');
const apiOrigin = process.env.REACT_APP_API_ORIGIN || '';
const url = apiOrigin ?
${apiOrigin.replace(/\/$/, '')}/upload: '/upload';const fd = new FormData();
fd.append('file', file);
await fetch(url, { method: 'POST', body: fd });
if (!res.ok) {
const text = await res.text().catch(() => null);
throw new Error(text ||
Upload failed ${res.status});}
return res.json();
}`
All reactions