overriting an image in ios mobile app
Hello,
I am using cloudinary in my ios mobile app but my problem is I want to override an image and the image is not overriding when I am using unsigned upload. The same project is connected to web app and the web app is overriding images with unsigned upload I am not guessing why it works with web app and not with the mobile app. Also I can't do signed upload because I don't have a backend server I am just using firebase.
Any help is appreciated. Thank you!
-
Hi,
Please note that
overwriteisn't supported for unsigned uploads. Since unsigned uploads has some vulnerability security-wise, if overwriting was enabled, anyone could take your code and upload new images while overriding existing resources of your account, not only their own pictures, but others too.
If you need to allow overwriting images, you might want to consider switching to signed uploads.0 -
Hi Shirly,
Thank you for your reply,
is there a way to implement a signed upload from my mobile app without a backend server because I am using firebase.
best regards !
0 -
In order to create signed upload, you will need to generate a signature.
Our best practice is to use some kind of server-side to generate the signature.
There is a way to generate the signature in the client side. however, this is not recommended because you'll need to put the API Secret on the client side and it's not secured.
Here is a sample code is swift:
func signedUploadImage()
{
let cloudinary = CLDCloudinary(configuration: config)
let timestamp = Int(Date().timeIntervalSince1970)
let signature = cloudinarySignParamsUsingSecret(["timestamp" : String(describing: timestamp)], cloudinaryApiSecret: (cloudinary.config.apiSecret)!)
let params = CLDUploadRequestParams().setResourceType(CLDUrlResourceType.image).setSignature(CLDSignature(signature: signature, timestamp: NSNumber(value: timestamp)))
let request = cloudinary.createUploader().signedUpload(
url: URL(string: "http://.....png")!, params: params as! CLDUploadRequestParams)
}0 -
Hey Shirly,
It's working... !
Thank you for your help you saved me a lot of time !
Best regards !
0
Post is closed for comments.
Comments
4 comments