psphsp Posted September 19, 2020 Share Posted September 19, 2020 Hello. I want to make a simple website, where I can upload a zip file and download it from a URL with just HTTP GET request. When I download the file, the file will then be deleted on the server. Can't find any examples. Maybe, I've searched wrong. Has somebody some written project links or some tips for me how can I achieve this? Quote Link to comment https://forums.phpfreaks.com/topic/311508-simple-single-use-file-sharing/ Share on other sites More sharing options...
requinix Posted September 19, 2020 Share Posted September 19, 2020 Make an upload script. The internet has a lot of resources to help with that. Be careful that you don't allow anybody who stops by to upload anything they want. Put the files somewhere not accessible through your website with a regular URL. Make a download script. Specifically, you need a PHP script that will download the requested file to your browser. Also lots of resources to help with that. URL rewriting would help. Then update that download script so it deletes the file after sending its contents. Quote Link to comment https://forums.phpfreaks.com/topic/311508-simple-single-use-file-sharing/#findComment-1581507 Share on other sites More sharing options...
psphsp Posted September 20, 2020 Author Share Posted September 20, 2020 I've searched a lot yesterday. Found also a lot of codes. One example: PHP File Upload The second sentence: Quote However, with ease comes danger, so always be careful when allowing file uploads! I found, that there can be a lot of vulnerabilities. Where can I look for a very secure upload form? Does somebody have an idea? Or should I do not program it with php? Quote Link to comment https://forums.phpfreaks.com/topic/311508-simple-single-use-file-sharing/#findComment-1581510 Share on other sites More sharing options...
requinix Posted September 20, 2020 Share Posted September 20, 2020 1 hour ago, psphsp said: Where can I look for a very secure upload form? Does somebody have an idea? The #1 way to have vulnerable code is to copy and paste what you find on the internet. There is no substitute for learning PHP and secure coding practices. That said, the thing you found is actually one of the safest versions I've seen in that it does not fall prey to any of the common problems that plague most of what you'll find online. Would be nice if they talked more about it, tried to address issues like file permissions or access control, but I suppose this is one of the few good examples of w3schools doing things right. Quote Or should I do not program it with php? Good developers write good code. Bad developers write bad code. Language has nothing to do with it. Quote Link to comment https://forums.phpfreaks.com/topic/311508-simple-single-use-file-sharing/#findComment-1581511 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.