TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

$ cat ~/myfile | curl -X PUT --upload-file “-” https://transfer.sh/myfile.txt

296 pointsby _hv99about 9 years ago

41 comments

colandermanabout 9 years ago
FYI PUT is misused here. From RFC 7231 [1]:<p><pre><code> The PUT method requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload. A successful PUT of a given representation would suggest that a subsequent GET on that same target resource will result in an equivalent representation being sent in a 200 (OK) response. </code></pre> Placing the PUT body at a different location and returning a pointer to it is not supported by this definition. Furthermore:<p><pre><code> Proper interpretation of a PUT request presumes that the user agent knows which target resource is desired. A service that selects a proper URI on behalf of the client, after receiving a state-changing request, SHOULD be implemented using the POST method rather than PUT. If the origin server will not make the requested PUT state change to the target resource and instead wishes to have it applied to a different resource, such as when the resource has been moved to a different URI, then the origin server MUST send an appropriate 3xx (Redirection) response; the user agent MAY then make its own decision regarding whether or not to redirect the request. </code></pre> That is, to get the effect you intend, you should either (a) use POST (from which you should return a 201 with the final destination, <i>not</i> 200 like you currently do), or (b) issue a 307 redirect to the final destination of the PUT before accepting any content (and subsequently replying with a 201).<p>[1] <a href="http:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7231#section-4.3.4" rel="nofollow">http:&#x2F;&#x2F;tools.ietf.org&#x2F;html&#x2F;rfc7231#section-4.3.4</a>
评论 #11322952 未加载
scrollawayabout 9 years ago
Why give that elaborate command line call instead of the clearer, simpler one in the example?<p><pre><code> curl --upload-file .&#x2F;hello.txt https:&#x2F;&#x2F;transfer.sh&#x2F;hello.txt </code></pre> In any case - cool! Good domain name too.
评论 #11322458 未加载
评论 #11322552 未加载
评论 #11322535 未加载
charonn0about 9 years ago
FYI The &quot;-X PUT&quot; argument is not doing what you think it is[1], and is superfluous since you&#x27;re using &quot;--upload-file&quot;.<p>You almost never really want &quot;-X&quot;.<p>[1]: <a href="https:&#x2F;&#x2F;curl.haxx.se&#x2F;docs&#x2F;manpage.html#-X" rel="nofollow">https:&#x2F;&#x2F;curl.haxx.se&#x2F;docs&#x2F;manpage.html#-X</a>
评论 #11327500 未加载
Depadoabout 9 years ago
Haw. I made quite the same service, curl compliant and stuff except it encrypts the file on disk upon reception (creating an AES cipher, piping the file through it while receiving it) and sending back the id of the file and the key that allows decryption of said file. If anyone is interested there&#x27;s plenty of documentation, even a client that allows to take screenshots and upload them on the fly.<p><a href="https:&#x2F;&#x2F;up.depado.eu" rel="nofollow">https:&#x2F;&#x2F;up.depado.eu</a><p>So yeah it&#x27;s limited to 30MB for now because I don&#x27;t have a lot of storage but hey I use that daily hehe
评论 #11323538 未加载
评论 #11325139 未加载
oxplotabout 9 years ago
It&#x27;d be cool to have the ability to pipe stuff over the Internet from shell in real time like you would with SSH for instance. So I could do:<p>A$ curl --upload-file - <a href="http:&#x2F;&#x2F;blah" rel="nofollow">http:&#x2F;&#x2F;blah</a> &lt; &#x2F;proc&#x2F;kmsg<p>B$ curl <a href="http:&#x2F;&#x2F;blah&#x2F;uYsfVX" rel="nofollow">http:&#x2F;&#x2F;blah&#x2F;uYsfVX</a><p>and see live stream of data on B.
评论 #11322315 未加载
评论 #11324686 未加载
评论 #11322269 未加载
评论 #11322376 未加载
评论 #11322310 未加载
armabout 9 years ago
Regarding their tagline: “<i>Easy file sharing from the command line</i>”, this is also possible with Yandex Disk¹ (specifically, the Linux version here²). It also has less limitations than transfer.sh, specifically:<p>• 10 GB of space for free (with a 10 GB filesize limitation³) over transfer.sh’s 5 GB<p>• no file expiration date, unlike transfer.sh’s 14-day expiration<p>――――――<p>¹ — <a href="https:&#x2F;&#x2F;disk.yandex.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;disk.yandex.com&#x2F;</a><p>² — <a href="https:&#x2F;&#x2F;repo.yandex.ru&#x2F;yandex-disk&#x2F;" rel="nofollow">https:&#x2F;&#x2F;repo.yandex.ru&#x2F;yandex-disk&#x2F;</a><p>³ — <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Comparison_of_file_hosting_services#cite_ref-94" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Comparison_of_file_hosting_ser...</a>
评论 #11322223 未加载
评论 #11322281 未加载
shaunpudabout 9 years ago
I like using chunk.io for this purpose too<p><pre><code> $ curl -T path&#x2F;to&#x2F;file chunk.io</code></pre>
评论 #11323013 未加载
krickabout 9 years ago
It doesn&#x27;t seem to be very cheep to run given enough users, yet I don&#x27;t see anybody trying to sell me something. So, how?
评论 #11323764 未加载
potatosareokabout 9 years ago
I always wonder how sites like these deal with stuff like potentially hosting child porn&#x2F;other content that is illegal to possess. Does DCMA safe harbor stuff cover it? (don&#x27;t see a DCMA notice on the site)
评论 #11322526 未加载
评论 #11322451 未加载
mscdexabout 9 years ago
This reminds me of a node.js-based utility I wrote awhile back called filebounce[1], except filebounce <i>streams</i> a file over HTTP&#x2F;HTTPS and does not store the file on an intermediary server. It also supports tailored curl and GUI browser-based interfaces. I use it as a simple way of copying a file without needing ssh, ftp, samba, etc.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;mscdex&#x2F;filebounce" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mscdex&#x2F;filebounce</a>
captn3m0about 9 years ago
Similar project: <a href="https:&#x2F;&#x2F;curl.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;curl.io&#x2F;</a>
评论 #11322279 未加载
cyborgx7about 9 years ago
Love the idea. But the link always leads to a page with the file on it, not the file itself. Specially for picture sharing that&#x27;s not really acceptable for me.
sagikabout 9 years ago
I use sprunge [<a href="http:&#x2F;&#x2F;sprunge.us&#x2F;" rel="nofollow">http:&#x2F;&#x2F;sprunge.us&#x2F;</a>] for the exact same purpose.<p>Normal usage: $ more c14.py | sprunge<p>And it outputs: <a href="http:&#x2F;&#x2F;sprunge.us&#x2F;eCeM" rel="nofollow">http:&#x2F;&#x2F;sprunge.us&#x2F;eCeM</a><p>The nice thing about sprunge is that you also have syntax highlighting: <a href="http:&#x2F;&#x2F;sprunge.us&#x2F;eCeM?py" rel="nofollow">http:&#x2F;&#x2F;sprunge.us&#x2F;eCeM?py</a><p>Appending a ?&lt;lang&gt; will syntax highlight the text according to the lang.<p>P.S.<p>To use a pipe with sprunge, put an alias in your .zshrc &#x2F; .bashrc:<p>alias sprunge=&quot;curl -F &#x27;sprunge=&lt;-&#x27; <a href="http:&#x2F;&#x2F;sprunge.us&quot;" rel="nofollow">http:&#x2F;&#x2F;sprunge.us&quot;</a><p>and then use source .&#x2F;zshrc ( or .bashrc ).
评论 #11322304 未加载
ycmbntrthrwawayabout 9 years ago
<a href="http:&#x2F;&#x2F;ix.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;ix.io&#x2F;</a><p>Uploading a file: curl -F &#x27;f:1=@file.ext&#x27; ix.io
评论 #11322598 未加载
mhwabout 9 years ago
I might be unusual here, but I typically get stuck when trying to copy files off a remote Windows machine. Most recently was an aged Windows server with a version of internet explorer so old that all the modern file upload sites (e.g. <a href="https:&#x2F;&#x2F;file.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;file.io&#x2F;</a>) seemed to have JavaScript issues. Windows built in WebDAV support didn&#x27;t work, because it&#x27;s not installed on Windows server I think.<p>Can anyone come up with a way to use a service like this from an old version of Windows that lacks modern web browser, powershell and so on?
评论 #11322746 未加载
评论 #11322170 未加载
评论 #11322595 未加载
评论 #11326100 未加载
Ficeabout 9 years ago
Why depend on a centralized service when there are easy-to-use decentralized alternatives?<p><pre><code> $ ipfs add myfile.txt added QmeeLUVdiSTTKQqhWqsffYDtNvvvcTfJdotkNyi1KDEJtQ myfile.txt # Access via a public gateway $ curl https:&#x2F;&#x2F;ipfs.io&#x2F;ipfs&#x2F;QmeeLUVdiSTTKQqhWqsffYDtNvvvcTfJdotkNyi1KDEJtQ # or via a local node $ curl http:&#x2F;&#x2F;127.0.0.1:8080&#x2F;ipfs&#x2F;QmeeLUVdiSTTKQqhWqsffYDtNvvvcTfJdotkNyi1KDEJtQ</code></pre>
评论 #11323768 未加载
评论 #11323991 未加载
ameliusabout 9 years ago
This requires the service to be available at all times.<p>A much more ingenious approach is ipfs: [1]<p>[1] <a href="https:&#x2F;&#x2F;ipfs.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ipfs.io&#x2F;</a>
sintaxiabout 9 years ago
This is very cool. I build a similar tool for entire web projects called surge.sh<p><pre><code> surge path&#x2F;to&#x2F;project example.com</code></pre>
评论 #11322765 未加载
ikeboyabout 9 years ago
You can use megatools to upload to a mega account from a command line, 50GB free, also encrypted.
blowskiabout 9 years ago
What&#x27;s the advantage of doing this instead of just using SCP or SFTP?
评论 #11322125 未加载
评论 #11322404 未加载
markbnjabout 9 years ago
Neat idea, and props for the https. Are the files encrypted on the server?
评论 #11322093 未加载
评论 #11322108 未加载
wenbinabout 9 years ago
I built a similar service but for email:<p>Send files to i@nfil.es<p>Then you&#x27;ll get something like this <a href="https:&#x2F;&#x2F;nfil.es&#x2F;EOir5z&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nfil.es&#x2F;EOir5z&#x2F;</a>
mnowotkaabout 9 years ago
How is it better than: [brew install gist] gist myfile.txt
jupiterrr88about 9 years ago
Using lisp with drakma, the following function save under name some content.<p>* (defun save(name content) (multiple-value-bind (a b c) (http-request (format nil &quot;<a href="https:&#x2F;&#x2F;transfer.sh&#x2F;~a&quot;" rel="nofollow">https:&#x2F;&#x2F;transfer.sh&#x2F;~a&quot;</a> name) :method :put :content (write-to-string content)) (list a b c)))
vtracabout 9 years ago
Very similar to a project of mine from 5 years ago: <a href="http:&#x2F;&#x2F;sbit3.me" rel="nofollow">http:&#x2F;&#x2F;sbit3.me</a><p>I even had a YN post: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=2598682" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=2598682</a> :)
stinosabout 9 years ago
<p><pre><code> PS&gt; cat myfile | out-string | iwr -Method Put -Uri https:&#x2F;&#x2F;transfer.sh&#x2F;myfile.txt</code></pre>
评论 #11322331 未加载
simula67about 9 years ago
Obligatory xkcd : <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;949&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;949&#x2F;</a>
评论 #11322367 未加载
ominousabout 9 years ago
I have been using paste.click [0] for a while, it is similar to this. I use to share snippets of code, or screenshots<p>[0] <a href="http:&#x2F;&#x2F;paste.click&#x2F;" rel="nofollow">http:&#x2F;&#x2F;paste.click&#x2F;</a>
knownabout 9 years ago
You made my day;<p>I&#x27;ve been using <a href="http:&#x2F;&#x2F;mktorrent.sourceforge.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mktorrent.sourceforge.net&#x2F;</a> for quite sometime now
yaumeeeabout 9 years ago
Reminds me an other project: <a href="https:&#x2F;&#x2F;github.com&#x2F;guits&#x2F;pastefile" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;guits&#x2F;pastefile</a>
评论 #11329224 未加载
voltagex_about 9 years ago
I like these simple web services.<p>One I use all the time is sprunge.us -<p><pre><code> $ echo &quot;hello world&quot; | curl -F sprunge=&quot;&lt;-&quot; sprunge.us http:&#x2F;&#x2F;sprunge.us&#x2F;MEPN</code></pre>
dchestabout 9 years ago
Useless Use Of Cat.
silverp1about 9 years ago
<a href="https:&#x2F;&#x2F;ptpb.pw" rel="nofollow">https:&#x2F;&#x2F;ptpb.pw</a> does pretty much the same exact thing and more.
xixixaoabout 9 years ago
Btw on mobile it&#x27;s not clear which line is input and which line is output. Perhaps make them in slightly different colors.
z3t4about 9 years ago
What is the business plan? Ads?
dzhiurgisabout 9 years ago
Idea where can such service be used for nefarious purposes:<p><pre><code> while true do dt=$(date &#x27;+%d%m%Y%H:%M:%S&#x27;); screencapture -x file$dt.png curl --upload-file .&#x2F;file$dt.png https:&#x2F;&#x2F;transfer.sh&#x2F;66nb8&#x2F;capture$dt.png rm file$dt.png sleep 1 done</code></pre>
评论 #11323911 未加载
Omnipresentabout 9 years ago
Are the files being accepted by your service as multipart&#x2F;form-data?
ccvannormanabout 9 years ago
This seems like the same as termbin.com to me.
Slixabout 9 years ago
How do people feel about .sh domains?
ameliusabout 9 years ago
Unfortunately, it is not practical to run this at home, because of asymmetric up&#x2F;download speeds of my internet provider (upload is 20x slower than download).<p>Sigh!
lolidaisukiabout 9 years ago
There are a lot of sites like this. The only thing that&#x27;s sorta neat about this file is that the filesize limit is so high. Getting around the size limit is fairly easy by using split or something similar so that&#x27;s not too big of a deal.<p>Others that come to mind are pomf.se clones like 1339.cf or comfy.moe and nekuneku&#x27;s current site, uguu.se. Many paste services could also be used to achieve the same result, ix.io and sprunge.us come to mind.