EvoTalk

15 六月, 2006

Upload File

Posted by: asd In: Code Snippet| Script| 程式設計 ()

有時候臨時要傳一個檔案與別人分享,用msn傳嫌太慢,需要一個臨時上傳的空間。網路上有許多免費上傳檔案的空間,若能與檔案總管整合在一起使用,那就很方便。底下的 bat 即是此應用的實現,需搭配 curl 使用 。

Visual Basic:
  1. @echo off
  2. del tmp.txt 2> nul
  3. setlocal ENABLEDELAYEDEXPANSION
  4.  
  5. :LOOP
  6. if ()==(%1) GOTO END
  7. curl -o 1.htm -F filetoupload=@%1 -F submitted="Upload File" http://mooload.com/new/upload/upload.php
  8. for /f "tokens=1 delims=>"  %%i in ('findstr file.php 1.htm ^| findstr href') do @(
  9. set url1=%%i_
  10. rem echo ORig url1: !url1!
  11. rem echo !url1:~5,-1!
  12. curl -o 2.htm !url1:~5,-1!
  13. for /f "tokens=2 delims==>" %%j in ('findstr Click 2.htm') do @(
  14. set url2=%%j
  15. rem echo ORig url2: !url2!
  16. rem echo !url2:~1,-1!
  17. echo !url2:~1,-1!>> tmp.txt
  18. )
  19. )
  20.  
  21. shift
  22. goto LOOP
  23.  
  24. :END
  25.  
  26. IF EXIST tmp.txt start tmp.txt
  27.  
  28. del 1.htm 2.htm 2> nul
  29.  
  30. setlocal DISABLEEXTENSIONS

存檔「上傳檔案.bat」,放到非系統槽的任一地方,拉一個捷徑到SendTo資料夾,用捷徑的方式才能改變圖示。在欲上傳的檔案(可多選),按右鍵,選擇「傳送到-> 上傳檔案」即可。上傳完畢會開啟記事本,內容是下載網址。此上傳網路空間不限制檔案格式,就算是圖檔、執行檔也可以上傳 upload filessend to

Tags:

Releated Posts



1 Response to "Upload File"

1 | CityPig

六月 30th, 2006 at 16:34

Avatar

確實很方便

Comment Form