大家平时手机给电脑传文件用什么工具?

可以写个 Web 服务,同一个局域网下手机电脑一般可以互联。比如底下是用 Emacs 实现的,下面的截图就是在手机上截的,然后用这个办法传上到电脑的。

(require 'web-server)
(ws-start
 '(((:GET . ".*") .
    (lambda (request)
      (with-slots (process headers) request
        (ws-response-header proc 200 '("Content-type" . "text/html"))
        (process-send-string
         process
         "\
<meta name='viewport' content='width=device-width, initial-scale=1'>
<h1>Upload File</h1>
<form method='post' enctype='multipart/form-data'>
  <input type='file' name='file'>
  <input type='submit'>
</form>
"))))
   ((:POST . ".*") .
    (lambda (request)
      (with-slots (process headers) request
        (let-alist (assoc-default "file" headers)
          (let ((out (make-temp-file "x-" nil .filename)))
            (let ((coding-system-for-write 'binary))
              (write-region .content nil out))
            (message "[%s] saved %d bytes to %s"
                     (current-time-string)
                     (string-bytes .content)
                     out)
            (ws-response-header process 200 '("Content-type" . "text/plain"))
            (process-send-string process (format "saved to %s\n" out))))))))
 9008 nil :host "0.0.0.0")
7 个赞