How to upload text file (.txt) in cloudinary using nodejs? - node.js

I have a text file with extension ".txt" that needs to be uploaded on Cloudinary. Cloudinary is not allowing me to do that.
Any help on this will be appreciated.

What do you mean upload ".txt"?
I googled it and first few seconds into the research I found this:
[![enter image description here][1]][1]
[![enter image description here][2]][2]
It's a image/video hosting service not a cloud storage service.
But there are tons of such services that allow uploading
[1]: https://i.stack.imgur.com/b09yV.png
[2]: https://i.stack.imgur.com/aGbyO.png

You didn't specify what error you're receiving, but Cloudinary does support non-image, non-video uploads, which are called 'raw' files: https://cloudinary.com/documentation/upload_images#uploading_non_media_files_as_raw_files
A possible error you may encounter is if you haven't set the resource_type to raw in your API call, or if you've set resource_type to auto but the filename of the uploaded file wasn't sent on the upload API call. In that case, it's likely that Cloudinary was expecting an image file, and didn't detect that you sent a .txt file.
If so, you'll receive an 'invalid image file' error if the file was treated as an image - specifying the resource type explicitly should resolve that

Related

Uploading PDF to Azure Blob Storage via Groovy - Issues with pictures

I have the request to Upload a PDF from SFTP to Azure Blob which is working for text based PDF only.
If I have a PDF with pictures the PDF ulploaded is faulty (missing pictures)
If I use the "normal" bytearrayoutputsream and return a string I convert it back to PDF and it works.
The issue only occours using Azure methods:
I use this line of code to so:
def body = message.getBody(String.class)
BlobOutputStream blobOutputStream = blob.openOutputStream()
blobOutputStream.write(body.getBytes())
blobOutputStream.close()
A correct PDF with pictures is expected. How to do so ?
As suggested by Priyanka Chakraborti If using open connectors with Cloud Plateform intergation(CPI) is an option, then you can refer to the blogpost. The files will not be corrupted in that case.

Document AI unsupported input file format

Since the last update with Document AI nodeJS API, I'm not able to send in jpeg file formats any more. I received the following message first:
Error: 3 INVALID_ARGUMENT: At this time, the only MIME types supported are 'application/pdf','application/json', 'image/gif' and 'image/tiff'.
When I changed my code to handle TIFF images I get the following message:
"(node:15782) UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT: Unsupported input file format."
I'm sure the file is a TIFF, I store it in cloud storage first and the content type is described as "image/tiff"
I attached some images for clarification.
The Document AI API has been updated in the time since this post was originally made. I recommend using the v1 REST API and Node.JS Client Libraries
The Supported Files page in the documentation also lists the supported File Types with the appropriate MimeTypes.
I have ever had a similar problem to you with PDF file.
I uploaded pdf files to google cloud storage and was going to run document AI NodeJS API with the files, but I got the same error as you.
"(node:15782) UnhandledPromiseRejectionWarning: Error: 3 INVALID_ARGUMENT: Unsupported input file format."
In my code, the mimeType was set into 'application/pdf'.
But the problem was fixed after the mimeType was set into 'PDF'.
I wonder if this helps you even a little bit.

how to save the binary of image of multi part form in node js

upload imageI am trying to make upload image in pure nodejs, please don't ask me why you do that cuz I am obliged to make it in pure node js I parsed the request header and I checked about image uploading or any files and I have in the console these bytes of image req data. and I**strong text** am tried to save it with fs module and the image saved successfully but when opening it gives me "this file format can't be opened"
how can i save the uploaded image ??

Can Gitlab API upload file to repo?

https://docs.gitlab.com/ee/api/projects.html#upload-a-file
After upload image, I got the url, but didn't added to my repo files?
Can we upload image to repo files?
The /projects/:id/uploads doesn't add anything to your project's repository. The description says:
Uploads a file to the specified project to be used in an issue or merge request description, or a comment.
To upload a file to the actual repo you need to use the /projects/:id/repository/files/:file_path endpoint.
To upload an image specifically, you'll need to:
Set the encoding parameter to base64
Convert your image to base64
Remove the data:image/png;base64, part at the beginning
Set the content parameter to the remaining part of the base64

Amazon S3 403 Forbidden Error for KML files but not JPG files

I am able to successfully upload (put object) jpg files to S3 with a particular code path, but receive a 403 forbidden error when using the same code path to upload a KML file. I am not restricting file types explicitly with "bucket policy," but feel that this must somehow be tied to bucket policy or CORS configuration.
I was using code based off the Heroku tutorial for uploading images to Amazon S3. The issue ended up being that the '+' symbol in the appropriate mime type is "application/vnd.google-earth.kml+xml" and the + symbol was being replaced with a space when fetching the file-type query parameter for our own S3 endpoint to generate signed requests. We were able to quickly fix this by just forcing the ContentType to be "application/vnd.google-earth.kml+xml" for all kml files going to our endpoint for generating signed S3 requests.

Resources