<story><title>Show HN: Host your own minimal file sharing site (now with expiring files)</title><url>https://github.com/nikosch86/file-upload</url></story><parent_chain></parent_chain><comment><author>stephenr</author><text>Please investigate &amp;#x27;safe&amp;#x27; php file upload handling, specifically: the `is_uploaded_file` and `move_uploaded_file` functions.&lt;p&gt;Also perhaps consider the `mkdir` function, and perhaps &amp;#x27;file_put_contents&amp;#x27;. Your reliance on shell functions via `exec` is quite concerning, given what you&amp;#x27;re doing.&lt;p&gt;Lastly, I&amp;#x27;d suggest either `random_int` or `random_bytes` (combined with e.g. bin2hex, or a hashing function to get an ascii string) instead of uniqid.&lt;p&gt;I&amp;#x27;m not quite sure why there&amp;#x27;s a check on user agent, to carry out the same logic regardless?</text></comment>
<story><title>Show HN: Host your own minimal file sharing site (now with expiring files)</title><url>https://github.com/nikosch86/file-upload</url></story><parent_chain></parent_chain><comment><author>oefrha</author><text>There are already transfer.sh [1] and other established projects (which I can’t recall right now) that serve this purpose. With more fine-grained control too. A golang compiled executable is also arguably more lightweight than a php app, whether the feature set&amp;#x2F;code is simpler or not.&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;dutchcoders&amp;#x2F;transfer.sh&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;dutchcoders&amp;#x2F;transfer.sh&amp;#x2F;&lt;/a&gt;&lt;p&gt;Edit: Since more than one person has replied with non-self-hosted solutions, I should note that &lt;i&gt;transfer.sh can be self-hosted&lt;/i&gt;, although you can also use the website itself.</text></comment>