Added Video support for document upload. IO-524
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { UploadOutlined } from "@ant-design/icons";
|
||||
import { Button, Upload } from "antd";
|
||||
import { Upload } from "antd";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -50,11 +50,7 @@ export function DocumentsUploadComponent({
|
||||
<UploadOutlined />
|
||||
</p>
|
||||
<p className="ant-upload-text">
|
||||
Click or drag file to this area to upload
|
||||
</p>
|
||||
<p className="ant-upload-hint">
|
||||
Support for a single or bulk upload. Strictly prohibit from
|
||||
uploading company data or other band files
|
||||
Click or drag files to this area to upload.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -93,9 +93,10 @@ export const uploadToCloudinary = async (
|
||||
formData.append("timestamp", timestamp);
|
||||
formData.append("signature", signature);
|
||||
|
||||
//Upload request to Cloudinary
|
||||
const cloudinaryUploadResponse = await cleanAxios.post(
|
||||
`${process.env.REACT_APP_CLOUDINARY_ENDPOINT}/upload`,
|
||||
`${process.env.REACT_APP_CLOUDINARY_ENDPOINT}/${DetermineFileType(
|
||||
fileType
|
||||
)}/upload`,
|
||||
formData,
|
||||
{
|
||||
...options,
|
||||
@@ -156,3 +157,13 @@ export const uploadToCloudinary = async (
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
export function DetermineFileType(filetype) {
|
||||
console.log("Checking Type", filetype, filetype.startsWith("video"));
|
||||
if (!filetype) return "auto";
|
||||
else if (filetype.startsWith("image")) return "image";
|
||||
else if (filetype.startsWith("video")) return "video";
|
||||
else if (filetype.startsWith("application/pdf")) return "image";
|
||||
|
||||
return "auto";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user