Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialKyle V
781 PointsHow do I Upload an Image to a Server through HTTP POST Request using FILES variable?
Hello, I am currently building an app in Xcode using Objective C and I need to post two text variables and an image. As of right now, I can only post the two text variables but I would like to send an image from my UIImageView to the server by using the FILES variable from the HTTP POST Request.
Existing Code Formatted: https://docs.google.com/document/d/1YL1EV9LBh5P5uNmvroQ-zpV_1Yv_FUGxhnaYAwz45LE/edit?usp=sharing
As you can see, I am posting the user editable text as well as a link for the post. Also, you might notice that I am attaching "process=writepost&auth_token=%@&app_id=0" and those are just needed for the server to recognize who is posting and what process is being sent to the specific URL.
Now, I would like to attach an image to the POST request by adding an image from the UIImageView. How would I attach it into the FILES variable for the POST request?
Any help would be gladly appreciated.
Thanks in advance, Kyle
Kyle V
781 PointsNope, I am trying to upload the image and text to a PHP server by using a HTTP Post Request
obey me
1,135 Pointsobey me
1,135 PointsAre you trying to save the image to parse