Jump to content

Recommended Posts

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?

 

Link to comment
https://forums.phpfreaks.com/topic/311508-simple-single-use-file-sharing/
Share on other sites

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.

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?

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.