I have hosted my JavaEE website ImgEcho in which I have given functionality through which users can upload an image. When I implemented this website on localhost I directly gave the path where the uploaded image would be stored as "C:/ProjectName/images"
However, I cant figure out what should be my path on the hosting server. P.S: I should ask this question to the customer support of my hosting server but they have trashy service. Thanks in advance.
Depending on what you want, there are many different things that you can do in this situation.
If you want to have a single, shared image folder, in which you store the images of all users, than I recommend that you create an images
directory within your projects root.
Otherwise, if you want to create a image storage that is per-user, than you can do the following:
-Project Root
|-User 1
|-images
|-account
|-User 2
|-images
|-account
This is a structure that contains every user in a separate folder, with the subfolders images
, which contains the images for that user, and account
, the storage for that user's account details and other information. This is generally more structured of a setup, and will benefit you long-term, although more advanced.
For a more scalable approach, perhaps in the future if you are willing to scale up your service, I recommend getting a large external network hard drive, or NAS (Network-attached storage), and then using that for all of the image storage. This will be very advanced, and possibly pricey, which is why it would be a long-term decision, that could quite possibly benefit your company in the future, because of the scalability.
Overall, I would generally use an images
directory, regardless of the rest of the folder structure, as it is the most logically correct decision for your current situation.
EDIT: To make this setup more secure, I recommend putting the images
directory into a custom, unrecognised archive file, and then converting the data when you need to use it, and back again when a change is made. This ensures no sneaky users opening your images because it is stored in a plain folder layout.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments