{"id":1494,"date":"2021-07-05T02:21:10","date_gmt":"2021-07-04T17:21:10","guid":{"rendered":"http:\/\/leenux.kr\/?p=1494"},"modified":"2021-07-14T11:07:41","modified_gmt":"2021-07-14T02:07:41","slug":"flutter-%ed%94%8c%eb%9f%ac%ed%84%b0-%ec%9b%b9-%ed%8c%8c%ec%9d%bc-%ec%97%85%eb%a1%9c%eb%93%9c%ed%95%98%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/leenux.kr\/?p=1494","title":{"rendered":"[Flutter] \ud50c\ub7ec\ud130 \uc6f9 \ud30c\uc77c \uc5c5\ub85c\ub4dc \uad6c\ud604\ud558\uae30"},"content":{"rendered":"\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"><strong>FilePicker \ud328\ud0a4\uc9c0\ub97c \ud1b5\ud574 File \uc5c5\ub85c\ub4dc\ub97c \uad6c\ud604\ud560 \uc218 \uc788\uaca0\uc9c0\ub9cc FilePicker\ub294 \uc77c\ubc18 html\uc758 \ud30c\uc77c\uc5c5\ub85c\ub4dc\ud558\uae30 \ubc84\ud2bc\uc774 \ub77c\uc778 \uc704\uc82f\uc5d0\uc11c\ub3c4 \ubcf4\uc774\ub294 \uc774\uc288\ub97c \ubcf4\uc774\uace0 \uc788\ub2e4, <\/strong><br><strong>\ud558\uc9c0\ub9cc FileUploadInputElement \ub97c \ud1b5\ud574 \ud574\ub2f9 \ubb38\uc81c\ub97c \ud574\uacb0\ud558\uace0 \uad6c\ud604\uc744 \ud560 \uc218 \uc788\uc73c\uba70 FilePicker \ud328\ud0a4\uc9c0\ub97c \uc0ac\uc6a9\ud558\uc9c0 \uc54a\uc544 \ud504\ub85c\uc81d\ud2b8\uc758 \uc6a9\ub7c9 \ubc0f \uc131\ub2a5\uc744 \ub192\uc77c \uc218 \uc788\ub2e4.<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/api.dart.dev\/stable\/2.10.4\/dart-html\/FileUploadInputElement-class.html\">FileUploadInputElement \uacf5\uc2dd\ubb38\uc11c<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>final FileUploadInputElement input = FileUploadInputElement();\n              input..accept = '.png,.jpg,.jpeg'; \/\/\/ \ud655\uc7a5\uc790 \uc124\uc815\n              input.click();    \n              input.onChange.listen((event) {\n                File file = input.files.first;\n                print(\"\uc774\ub984 : ${file.name}\");\n                print(\"\ud0c0\uc785 : ${file.type}\");\n                print(\"?? : ${file.relativePath}\");\n                print(\"\uc2dc\uac04 : ${file.lastModifiedDate}\");\n                print(\"\uc0ac\uc774\uc988 : ${file.size}\");                     \n              });<\/code><\/pre>\n\n\n\n<p class=\"has-text-color has-medium-font-size has-very-dark-gray-color\"><strong>\uc774\ubbf8\uc9c0 \ub744\uc6b0\uae30 \ubc29\ubc95\uc740 \uba3c\uc800 FileReader \uac1d\uccb4\ub97c \uc0dd\uc131 \ud6c4 readAsDataUrl \ud568\uc218\uc758 \ub9e4\uac1c \ubcc0\uc218\ub85c \ud30c\uc77c\uc744 \ub123\uc5b4\uc900 \ub2e4\uc74c\uc5d0 reader.onLoadEnd.listen\uc548\uc5d0\uc11c Base64Decoder \ud074\ub798\uc2a4\ub97c \ud1b5\ud574 \ubcc0\ud658\ud558\uba74 \ub41c\ub2e4.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\/ Uint8List\ub85c \ubcc0\ud658\nfinal FileUploadInputElement input = FileUploadInputElement();\n              input..accept = '.png,.jpg,.jpeg';\n              input.click();\n              input.onChange.listen((event) {\n                File file = input.files.first;\n                print(\"\uc774\ub984 : ${file.name}\");\n                print(\"\ud0c0\uc785 : ${file.type}\");\n                print(\"?? : ${file.relativePath}\");\n                print(\"\uc2dc\uac04 : ${file.lastModifiedDate}\");\n                print(\"\uc0ac\uc774\uc988 : ${file.size}\");\n                final reader = FileReader();\n                reader.onLoadEnd.listen((_) {\n                  setState(() {\n                    [\ubcc0\uc218] = Base64Decoder().convert(reader.result.toString().split(\",\").last);\n                  });\n                });\n                reader.readAsDataUrl(file);        \n              });<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>[Flutter] \ud50c\ub7ec\ud130 \uc6f9 \ud30c\uc77c \uc5c5\ub85c\ub4dc \uad6c\ud604\ud558\uae30<\/p>\n","protected":false},"author":1,"featured_media":1001,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[88,87],"_links":{"self":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1494"}],"collection":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1494"}],"version-history":[{"count":3,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1494\/revisions"}],"predecessor-version":[{"id":1498,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/posts\/1494\/revisions\/1498"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=\/wp\/v2\/media\/1001"}],"wp:attachment":[{"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leenux.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}