What should be my path when I want users to upload file on my website?

Saumil

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.

DripDrop

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.

edited at
0

Comments

0 comments
Login to comment

Related

my html file path does not seem to want to work and from what I am aware everything is being done as it should be

what should I do If I want to do nothing in the one of my execution path in Background trigger cloud function?

When I upload my CSS file to my website the website is ignoring all styling options for my h3 tag

How can I allow users of my website to upload media files?

I want my website users to receive payments from other users on the website?

Python, Should I upload my .coverage file to my github repository?

What format should I write my .txt file if I want to getline for C++ program?

What should I look at if I want to buy RAM to my PC?

I want to add image when I share my website link

What should be in the /etc/shadow file if I want my root account to be disabled?

What is gvfs and why should I want it on my system?

I want to upload file to my server from localhost in php

when I want to use pyinstaller to package my python script, what should I do if I want to use "pygame.font.SysFont" in my script?

What icons should I create for my website in 2020?

Slightly confused with what function I should use with addEventListener in my Website

What java android files should I not upload to my SVN Server?

Why isn't my website found when I upload it to the host?

When should I ever want to use pandas apply() in my code?

When should I (not) want to use pandas apply() in my code?

Should I have one big angular file for my entire website?

When I enter nothing my program says I dont want eat it, but it should text wanna eat. What's problem?

What path should I place my bare git repositories?

What should I put in my updating.php when I need to update users status if online or offline every 5 seconds?

What should be the return type of my Power BI function if I want to use it as axis value for my report

What should I type in python to open a file located on my desktop when using a Mac?

I want to use my Robotframework to upload file but my fileupload fill has no ID

How do I allow iOS users to upload a document via an html input field on my website?

I want to load balance my azure website

I want to stop my website from refreshing