Is it possible to upload xlsx file through Strapi admin panel? - cloudinary

I'm using Strapi CMS paired with Cloudinary for file storage. I've been uploading images just fine through the admin panel but I now need to be able to upload an xlsx file through the panel. I have had no luck with this
I know for a fact that Cloudinary supports xlsx files as I am able to upload my files through Cloudinary's console. However, whenever I try to upload it through Strapi, I get "Unsupported ZIP file" error.
I expected Strapi to be able to send my xlsx file to Cloudinary like it does with my images, since under the File Upload section of their docs, they state that "Thanks to the plugin Upload, you can upload any kind of files on your server or externals providers such as AWS S3".
I've been looking through their docs but I have not been able to find anything regarding file uploads that are not images. Any tips would be greatly appreciated.

When uploading the xlsx file make sure you are setting the 'resource_type' to 'raw' as by default Cloudinary takes the resource_type as image.

const result = await cloudinary.uploader.upload(
req.file.path,
{ folder: "details" ,resource_type: 'auto' },
function (error, result) {
console.log(result, error);
}
);

Related

How to load protected S3 images with Next.js Image component?

I'm trying to make a photo gallery app that gets its photos from an S3 bucket. The images are fetched through presigned urls. The problem is that when I use the Image component from Next, I get the following error: "url" parameter is valid but upstream response is invalid. I can't seem to find the problem. I already configured the domain in the next.config.js file.
I found the solution: Upgrade Next.js

How to get complete path or URL of a File in Dropbox?

I am uploading bulk files using Dropbox .NET API.
I want that after uploading the file how to get a complete path or URL like - "https://www.dropbox.com/work/Apps/*****/testinng234/1.mp3". So that I can able to use this link directly.
Please suggest me the best way and share some code.

Access private files with extra parameters AWS S3

I have quite a few PDF files which are stored as private on an AWS S3 storage.
I'm creating a url to access the pdf through python boto library (with signature and signed headers) and successfully able to access the files if I just provide the PDF file name. But I need to access these PDF files at a particular page and with some additional parameters (bold highlighted). e.g:
https://mybucket.amazonaws.com/media/private/xyz.pdf#page=6&zoom=100&toolbar=0&navpanes=0&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***********************&X-Amz-Date=20180925T044257Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=a9ba6473464trdfghf76c578475hdfjdbv792cf7f1193fe8a274549
When I try to access the file with additional params, it gives me 'Resource not found" error but without the params, it accessible.
Can anyone guide me to achieve this goal ?
SOLVED:
The issue was that we need to append the PDF arguments after the signature in the url.
In my case it was:
https://mybucket.amazonaws.com/media/private/xyz.pdf&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=***********************&X-Amz-Date=20180925T044257Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&X-Amz-Signature=a9ba6473464trdfghf76c578475hdfjdbv792cf7f1193fe8a274549#page=6&zoom=100&toolbar=0&navpanes=0

Can we download a S3 file using javascript in browser?

I need to download a S3 file(in GBs) using javascript in a browser. Please let me know if it is possible and if there are any article with the sample code.
I was able to download the file using the pre signed URL.
http://docs.aws.amazon.com/AmazonS3/latest/dev/PresignedUrlUploadObject.html
Steps:
1) Create a pre signed URL using the bucket, key name and the credential(Cognito).
2) Download the file using the pre signed URL. For downloading file using URL, We can find a lot of article online.

Handling file uploads with Restler

What is the best practice to implement file uploads using Restler framework?
I like to have a API call that get the file save it in CDN and return back the CDN file URL to the caller. What is the best way to implement it?
File upload to CDN using our API
This requires two steps, first is to get the file on the API server.
add UploadFormat to the supported formats
Adjust the static properties of UploadFormat to suit your need
From your api method use $_FILES and move_uploaded_file to get the file to the desired folder. This step is common for any php upload process.
Now that you have the file on the server
Upload it to CDN. You can use any means provided my your CDN. It can be ftp or using some SDK to do the upload
Construct the CDN url and return it to the client