Skip to content
Advertisement

How to make so people can upload files to my website and display them?

How to make so people can upload files to my website and display them, for example, I want people to be able to upload books like archive.org. FYI I do not know PHP. Heres my code

JavaScript

Please tell me what I need to add to this code. I don’t have any tried version of what I want. If any questions please ask.

HTML

JavaScript

php

JavaScript

Advertisement

Answer

A quick and easy solution:

index.html

JavaScript

upload.php

JavaScript

Notes:
$file_destination = ' '.$file_name; -> The ‘ ‘ represents in which directory after this one the file will be place in, so ‘ ‘ means that it will be placed in this directory, ‘test/’ means it will be placed in the test subdirectory of this directory, etc.

– If you want something more secure you could try this

– You could also look through one of these solutions

I’ve tried the script above and it seems to move the file but that file actually doesn’t exist in that directory.

So here’s an updated script that actually does work:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement