質問編集履歴
1
修正しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -67,3 +67,97 @@
|
|
67
67
|
|
68
68
|
|
69
69
|
回答よろしくお願いいたします
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
追記
|
78
|
+
|
79
|
+
Blobはアプリ開発ソフトのMonacaから作ってます
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
```ここに言語を入力
|
84
|
+
|
85
|
+
navigator.camera.getPicture(onSuccess, onFail,
|
86
|
+
|
87
|
+
{ quality: 50,destinationType: Camera.DestinationType.FILE_URI,encodingType:Camera.EncodingType.PNG,
|
88
|
+
|
89
|
+
sourceType: navigator.camera.PictureSourceType.SAVEDPHOTOALBUM});
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
function onFail() {
|
96
|
+
|
97
|
+
console.log("写真を取得できませんでした");
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
function onSuccess (imgUri) {
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
return new Promise(function(resolve, reject) {
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
window.resolveLocalFileSystemURL(imgUri, function success(fileEntry) {
|
112
|
+
|
113
|
+
console.log("get file: " + fileEntry.fullPath);
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
fileEntry.file(function(file){
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
var reader = new FileReader();
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
reader.onloadend = function(evt) {
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
var blob = new Blob([evt.target.result], {type: "image/png"});
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
console.log("blob size:" + blob.size);
|
140
|
+
|
141
|
+
formdata.append('_img',blob); ////これが添付するファイルです。
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
};
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
reader.readAsArrayBuffer(file);
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
}, function() {console.log(error);});
|
156
|
+
|
157
|
+
}, function() {console.log(error);});
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
});
|
162
|
+
|
163
|
+
```
|