overriting an image in ios mobile app

Comments

4 comments

  • Avatar
    Shirly Manor

    Hi,

    Please note that overwrite isn'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
    Comment actions Permalink
  • Avatar
    Hamza

    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
    Comment actions Permalink
  • Avatar
    Shirly Manor

    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
    Comment actions Permalink
  • Avatar
    Hamza

    Hey Shirly, 

    It's working... !

    Thank you for your help  you saved me a lot of time ! 

    Best regards !

    0
    Comment actions Permalink

Please sign in to leave a comment.