RangeNotSatisfiableError: Range Not Satisfiable 라고 에러가뜹...

RangeNotSatisfiableError: Range Not Satisfiable 라고 에러가뜹...

작성일 2023.08.26댓글 1건
    게시물 수정 , 삭제는 로그인 필요

클라이언트는 const uploadVideo = async () => { setPreviewVideo(null); const previewFileName = previewVideo.split('/').pop(); // 파일 이름만 추출 console.log(previewFileName); const formData = new FormData(); formData.append('video', { uri: previewVideo, name:previewVideo, // 파일 이름 type: 'video/mp4', // 비디오 타입 (비디오에 맞게 수정 가능) }); try { const response = await axios.post('http://192.168.219.103:4000/videoUpload', formData, { headers: { 'Content-Type': 'multipart/form-data', }, }); console.log('response data', response.data); // setVideoURL(previewFileName); } catch (error) { if (preview) { return; } else { Alert.alert('비디오를 업로드하는데 실패했습니다.'); } } }; const renderItem = ({ item }) => { const imageURL = item.body.split('ThisIsImageText')[1]+'.jpg' return( !item.body.split(':')[1].includes('ThisIsImageText') ? !item.body.split(':')[1].includes('ThisIsVideoText') ? <View style={[styles.messageContainer,{ alignSelf:item.body.split(':')[0] !== userId ?'flex-start':'flex-end', backgroundColor:item.body.split(':')[0] !== userId ? 'rgba(184, 249, 234, 1)':'rgba(226, 251, 101, 1)', }]}> <Text style={styles.messageText}>{item.body}</Text> </View> : <View> <Text style={{position:'absolute', alignSelf:item.body.split(':')[0] !== userId ?'flex-start':'flex-end', backgroundColor:item.body.split(':')[0] !== userId ? 'rgba(184, 249, 234, 1)':'rgba(226, 251, 101, 1)',zIndex:1}}>{item.body.split(':')[0]}:영상</Text> <Video useNativeControls={true} // 기본 비디오 컨트롤 사용 resizeMode="cover" // 변경된 부분 source={{uri:`http://192.168.219.103:4000/Videos/${item.body.split('ThisIsVideoText')[1]}`}} style={[styles.stVideo,{ alignSelf:item.body.split(':')[0] !== userId ?'flex-start':'flex-end', backgroundColor:item.body.split(':')[0] !== userId ? 'rgba(184, 249, 234, 1)':'rgba(226, 251, 101, 1)', }]} /> </View> : <View> <Text style={{position:'absolute', alignSelf:item.body.split(':')[0] !== userId ?'flex-start':'flex-end', backgroundColor:item.body.split(':')[0] !== userId ? 'rgba(184, 249, 234, 1)':'rgba(226, 251, 101, 1)',zIndex:1}}>{item.body.split(':')[0]}:사진</Text> <TouchableOpacity onPress={()=>{ handleImageDownload(imageURL); }} style={{position:'relative', top:25, padding:2, borderRadius:10, alignSelf:item.body.split(':')[0] !== userId ?'flex-start':'flex-end', backgroundColor:item.body.split(':')[0] !== userId ? 'white':'white',zIndex:1}}> <Text>다운로드</Text> </TouchableOpacity> <TouchableOpacity onPress={()=>{ setBigImage(item.body.split('ThisIsImageText')[1]); console.log(item.body.split('ThisIsImageText')[1]); }} > <Image style={[styles.ImageAndVideo,{ alignSelf:item.body.split(':')[0] !== userId ?'flex-start':'flex-end', backgroundColor:item.body.split(':')[0] !== userId ? 'rgba(184, 249, 234, 1)':'rgba(226, 251, 101, 1)', }]} source={{ uri: `http://192.168.219.103:4000/Images/${item.body.split('ThisIsImageText')[1]}.jpg` }} /> </TouchableOpacity> </View> ) }; 서버는 const storage2 = multer.diskStorage({ destination: 'public/Videos/', filename: function (req, file, cb) { cb(null, file.originalname); // 파일 이름으로 원본 파일 이름 사용 }, }); const upload2 = multer({ storage: storage2 }); app.post('/videoUpload', upload2.single('video'), (req, res) => { console.log(req.file); VideoList[req.file.originalname]++; const newImagePath = `public/Videos/${req.file.originalname}`; fs.renameSync(req.file.path, newImagePath); res.send(VideoList); console.log('videoList::::',VideoList); })


#rangenotsatisfiableerror range not satisfiable

profile_image 익명 작성일 -

RangeNotSatisfiableError: Range Not Satisfiable는 HyperText Transfer Protocol (HTTP)의 416 오류 응답 코드로, 서버가 요청된 범위를 제공할 수 없음을 나타냅니다. 가장 가능성이 높은 이유는 문서에 해당 범위가 포함되어 있지 않거나, Range 헤더 값이 구문적으로 올바르지만 의미가 없기 때문입니다. 이 오류를 해결하는 방법은 다양합니다. 예를 들어, 클라이언트 측에서 전체 문서를 다시 요청하거나, 서버 측에서 오류 처리 미들웨어를 추가하는 것입니다. 이러한 오류가 발생하는 원인을 파악하고 해결하기 위해서는 클라이언트와 서버의 코드를 자세히 살펴보아야 합니다. 이 문제에 대해 더 자세한 정보가 필요하시면 알려주세요.