@rpldy/upload-url-input
Installation
- npm
- Yarn
- pnpm
npm install @rpldy/upload-url-input
yarn add @rpldy/upload-url-input
pnpm add @rpldy/upload-url-input
Details
Input component to enter a URL (or any string for that matter) that will be sent as an upload.
This can be useful for services that accept a URL and do server-side fetch. Cloudinary is such a service.
Example
import React, { useRef } from "react";
import Uploady from "@rpldy/uploady";
import UploadUrlInput from "@rpldy/upload-url-input";
const MyUrlUpload = () => {
const uploadRef = useRef(null);
const onClick = () => {
if (uploadRef && uploadRef.current) {
uploadRef.current(); //initiate upload
}
};
return <Uploady>
<UploadUrlInput placeholder="URL to upload"
uploadRef={uploadRef} />
<button onClick={onClick}>Upload</button>
</Uploady>;
};