Skip to content

Saving images to MongoDB using Parse code #314

Closed
@fletcher100

Description

@fletcher100

Is there a way to save images to MongoDB through parse code just as you can with a string value? The images I am trying to save using my parse code are not showing up in MongoLab like my string values are.

I have read about something called GridFs is this what I am supposed to use for this task?

This example code from the Parse documentation does not seem to save an image file to the database.

let imageData = UIImagePNGRepresentation(image)
let imageFile = PFFile(name:"image.png", data:imageData)

var userPhoto = PFObject(className:"UserPhoto")
userPhoto["imageName"] = "My trip to Hawaii!"
userPhoto["imageFile"] = imageFile
userPhoto.saveInBackground()

Thank you for any guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions