본문 바로가기

coding5

[React] input file 태그 내에서 value 값 설정하기 - Failed to set the 'value' property on 'HTMLInputElement React 파일 태그 사용 간 value 설정 방법을 정리하려고합니다. input file 태그를 사용해 허용된 확장자가 아닌 경우 알람 및 value 초기화 수행하는 코드를 작성했습니다. 처음 코드 작성 시 태그 내 value 속성으로 초기화 수행 시 예외 발생으로 동일한 에러 발생되는 분은 코드 참고하세요 Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string. 1. 결과화면 a. 허용된 확장자(.msg) 파일 첨부 시 b. 허용된 확장자(.msg) 이외 파일 첨부 시 2. 소스 .. 2022. 9. 26.
React + C# .NET + fetch 사용하여 파일 다운로드(File download) 하기 React 와 .NET로 파일 다운로드 방법을 정리하려고합니다. 간단한 방법은 아래와 같습니다. 여담 : codesandbox사이트에서 검색한 소스 기반으로 작성, codesandbox 사랑합니다. 클라이언트 앱(react) view 페이지에서 Button 요소를 적절한 위치에 추가. Button 이벤트 추가 Button 버튼 클릭 시 fetch를 사용해 서버 호출 구현 서버 앱(.net) attachedDownload 함수 작성 1) 다운로드 대상 파일 2) 클라이언트 앱(react) //backend 서버 정보(.net) 명시해둠 const getServerAddress = () => { if (window.location.href.includes("localhost") > 0 ){ return "h.. 2022. 9. 22.
tcl/tk 사용하여 decoding 개발하기 ( url-decode ) tcl로 ascii코드를 특수문자로 변환(decoding) 방법을 정리하려고합니다. 코드는 아래와 같습니다. 1) url-decode 소스 proc url-decode { str } { # rewrite "+" back to space # protect \ from quoting another '\' set str [string map [list + { } "\\" "\\\\"] $str] # prepare to process all %-escapes regsub -all -- {%([A-Fa-f0-9][A-Fa-f0-9])} $str {\\u00\1} str # process \u unicode mapped chars return [subst -novar -nocommand $str] } 2) 함수 호.. 2022. 9. 15.
tcl/tk 사용하여 encoding 개발하기 ( url-encode ) tcl로 특수문자를 ascii코드로 변환(encoding) 방법을 정리하려고합니다. 코드는 아래와 같습니다. 1) url-encode 소스 proc url-encode {string} { variable map variable alphanumeric a-zA-Z0-9 #알파벳 및 숫자 필터 : 필터 외에 문자는 특수문자로 변환 실시 for {set i 0} {$i $map(\[) ... regsub -all {[][{})\\]\)} $string {\\&} string return [subst -nocommand $string] } 2) 함수 호출 부분 소스 set url "$url?c=pgmCompare&custCode=[url-encode $custCode]&device=[url-encode $dev.. 2022. 9. 6.