Skip to content

Saving images to MongoDB using Parse code #314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fletcher100 opened this issue Feb 9, 2016 · 2 comments
Closed

Saving images to MongoDB using Parse code #314

fletcher100 opened this issue Feb 9, 2016 · 2 comments

Comments

@fletcher100
Copy link

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.

@drew-gross
Copy link
Contributor

That code should result in an image saved in GridStore. Can you tell us what error messages you are getting? You can see error messages on the server by running the server with VERBOSE=1

@fletcher100
Copy link
Author

I figured out the answer to my question. Thank you anyways, drew-gross.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants