Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

92
Visualizações
cannot view post request image in console

i have a canvas where is stream video, i'm taking a snapshot of that and sending it to a server how do i know that i have sent the snapshot successfully to server ? i cant see anything in 'Preview' section and should my payload look like that ?. I can see the snapshot in front end using that img tag. status is :

enter image description here

and in payload getting:

enter image description here

and there is nothing in 'Preview'

enter image description here

const canvasRef = useRef(null);
  const [preview, setPreview] = useState('');

  const getImage = () => {
    return new Promise((resolve) =>
      canvasRef?.current.toBlob((blob) => {
        const src = URL.createObjectURL(blob);
        setPreview(src);
        resolve(blob);
      }),
    );
  };
 
 
 const takeSnapshott = async () => {
    let pollUrl = `api/cam/${first}/${second}/snap`;
   
    const blob = await getImage();
    // SEND THE BLOB TO YOUR SERVER
    const formData = new FormData();
    formData.append('file', blob, 'picture');
    try {
      const res = await fetch(pollUrl, {
        method: 'POST',
        headers: {
          'Content-Type': 'multipart/form-data',
        },
        body: formData,
      });
      const data = await res.text();
      console.log('resso', data);

      if (res.ok) console.log('SUCCESS', data);
      else throw new Error(data);
    } catch (e) {
      console.error(e);
    }

          <img src={preview} style={{ width: '100%', height: 'auto' }} />

about 4 years ago · Santiago Gelvez
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda