Skip to content

Commit 634a07c

Browse files
committed
Merge branch 'master' of github.com:zackify/react-use-upload
2 parents 39fd196 + f89b4f0 commit 634a07c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**Zero dependency, total control, file upload hook for React.**
1+
**Zero dependency, total control, file upload hook for React with upload progress.**
22

33
This has been rewritten into a single file for simplicity, and the function signature has gotten much smaller.
44

@@ -24,7 +24,7 @@ Here's a basic example of uploading a single file to a url
2424
const MyComponent = () => {
2525
let [upload, { progress, done, loading }] = useUpload(({ files }) => ({
2626
method: "PUT",
27-
url: url,
27+
url: "http://localhost:4000",
2828
body: files[0],
2929
}));
3030

@@ -56,7 +56,7 @@ const MyComponent = () => {
5656

5757
return {
5858
method: "PUT",
59-
url: url,
59+
url: "http://localhost:4000",
6060
body: formData,
6161
};
6262
});
@@ -68,7 +68,7 @@ const MyComponent = () => {
6868
type="file"
6969
onChange={(e) => {
7070
if (e.target.files) {
71-
upload({ file: e.target.files[0] });
71+
upload({ files: e.target.files });
7272
}
7373
}}
7474
/>
@@ -89,7 +89,7 @@ const MyComponent = () => {
8989

9090
return {
9191
method: "PUT",
92-
url: url,
92+
url: "http://localhost:4000",
9393
body: formData,
9494
headers: { Authorization: "test" },
9595
};
@@ -102,7 +102,7 @@ const MyComponent = () => {
102102
type="file"
103103
onChange={(e) => {
104104
if (e.target.files) {
105-
upload({ file: e.target.files[0] });
105+
upload({ files: e.target.files });
106106
}
107107
}}
108108
/>
@@ -125,7 +125,7 @@ const MyComponent = () => {
125125

126126
return {
127127
method: "PUT",
128-
url: url,
128+
url: "http://localhost:4000",
129129
body: formData,
130130
headers: { Authorization: "test" },
131131
};
@@ -138,7 +138,7 @@ const MyComponent = () => {
138138
type="file"
139139
onChange={(e) => {
140140
if (e.target.files) {
141-
upload({ file: e.target.files[0] });
141+
upload({ files: e.target.files });
142142
}
143143
}}
144144
/>
@@ -172,7 +172,7 @@ const MyComponent = () => {
172172
return {
173173
method: "PUT",
174174
url: url,
175-
// send a single file in the body to the storage bucker
175+
// send a single file in the body to the storage bucket
176176
body: files[0],
177177
};
178178
});
@@ -190,7 +190,7 @@ const MyComponent = () => {
190190
type="file"
191191
onChange={(e) => {
192192
if (e.target.files) {
193-
upload({ file: e.target.files[0] });
193+
upload({ files: e.target.files });
194194
}
195195
}}
196196
/>

0 commit comments

Comments
 (0)