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 trial


How can other users post content on my app.Like a picture for example.

I want to make an app where other users can login and post pictures of their own.I also want to ask how i can make a comment section for each individual post

5 Answers

Harry James
Harry James
14,780 Points

Hello, sorry about the delay.

If you're going to run a Server, you have two options:

1) You can purchase a Server from an online company.

2) You can use an old computer from home and run a Server from there.

Note that if you choose option 2, you will be required to port forward your home internet connection which, if not done correctly can lead to major vulnerabilities to your network. Also, you risk your network being attacked through methods such as (D)DOS (A flood of IP's being sent to your open network that connect so frequently that they attempt to crash or significantly slow down the network). Hosted servers will usually deal with the security side for you, leaving you safe from these attacks (Or they will try to resolve the attack as soon as possible).

To run a Server, you most likely will want to set up a system where a user will upload a photo to the site. I believe the best way to do this would be via FTP however, you would have issues then calling back when the photo has been uploaded which, could lead to some issues.

I believe to best achieve what you are trying to do, you would require the user to set up an FTP connection to the Server (Probably using Anonymous FTP) that would allow the user to upload a photo to the Server (It would be important that the directory where the photos would be saved is read-only to prevent any bad guys from deleting all of the photos). Before the file is uploaded, however, you should probably add some checks like "Is the file less than 5MB?" and also probably rename the file to something like a date.

I believe displaying the images would be the harder bit. You could view all of the files at the directory by navigating to the folder like "file:///C:/Users/Me/Documents/" in Chrome. But, you would need a decent way of grabbing all of the photos in this folder and displaying them.

I have never done this before but believe that you could always use JSON and node.js to do this. Perhaps a script that would clear a JSON file then populate it with all of the files in the file system (See http://stackoverflow.com/questions/11194287/convert-a-directory-structure-in-the-filesystem-to-json-with-node-js).

Once you've achieved this and have a working JSON file that would repopulate (Or if you have a lot of photos, a more efficient method would be to just add a new entry on every upload) then you could grab this JSON data in your app and then use it to display images (Such as the latest 5 images). Of course, you could always skip JSON but, note you would have to know the path of each image and then manually write them in to your app which, isn't beneficial.

Hope this helps!

Harry James
Harry James
14,780 Points

I would highly recommend Parse for this. They'll be able to cater for submitting and sending images without the need for you to run your own Server.

I highly recommend you go through the tutorials in order as, eventually you will get to this video on Building a Self-Destructing Messaging App which talks about Parse in detail. I'm sure from here, you'll be able to understand how you'd be able to achieve what you want. If not, I and other forum users will be happy to help you.

If you are a Pro User, you can always check out this workshop on Using Parse as the backend for an Android App. It may be a little outdated now but, it still provides the same concept.

Hope it helps and, if you have any further questions, feel free to ask!

Hey thanks for the reply, Parse is not fully free though,it's pretty expensive too.Is it possible for me to run my own server?How do i go about doing that?

Harry James
Harry James
14,780 Points


Parse is actually completely free but it does have limits. However, these limits should suit your needs. If your app does grow, however, you can always scale your upgrades whenever you need. That's the beauty of Parse!

If you do go along the path of running your own server, you will have to set up a system of your own that will allow users to upload a file to your server which would then be grabbed by other users via a web link. This will most likely be done using a technique like FTP. If you do decide to take this path, I can provide you with a bit more help and information but, note that you would probably be at a higher risk of vulnerabilities and it would require a bit of further setting up.

I'd like to know more please.I'm not cheap or anything but it would be nice to be able to run my own server at no additional cost.What are some of the disadvantages i may face ?I dont mind setting it up though even if takes me some time

Thanks for the information harry.That looks complicated though i will attempt to create my own server.Thanks alot!