D
D
Dmitry2016-01-12 12:44:51
PHP
Dmitry, 2016-01-12 12:44:51

How to save images to the server using php?

There is a VPS on which the site is hosted, the web server is apache. It is necessary to implement uploading custom images to the server. Interested in how to ensure the security of the server at the same time. I think that this problem is common and for sure the community has a proven solution. This task has many aspects, such as configuration from the web server side, placing storage on a subdomain or main domain, naming uploaded files, organizing a whitelist for files. I could not find up-to-date and complete information to solve this problem. Guru, give me a list of actions that will lead me to solve this problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander N++, 2016-01-12
@sanchezzzhak

Take and upload
Create a folder where you will put the files.
You write a script that uploads files to this folder.
You check that the user is uploading exactly the picture
In the ngnix or apache cnofigs, disable the execution of scripts in the folder where you will put user photos ..

Z
ZmeY, 2016-01-21
@ZmeY

1. upload the file to a directory that is outside the site root (so that it is not directly accessible)
2. give the file with your PHP script, with the correct headers - there is generally scope for content control

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question