差異處
這裏顯示兩個版本的差異處。
| 兩邊的前次修訂版 前次修改 | |||
| tech:curl_post_file [2008/11/02 15:55] – jonathan | tech:curl_post_file [2008/11/02 15:56] (目前版本) – jonathan | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| + | ====== cURL 上傳 multipart/ | ||
| + | 假設要上傳的網頁 form 如以下所示: | ||
| + | <code html> | ||
| + | <form enctype=" | ||
| + | <input type=" | ||
| + | <br /> | ||
| + | Send this file: <input name=" | ||
| + | <input type=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | 這表示要上傳要有 id 與 uploadfile (檔案) | ||
| + | |||
| + | cURL 的語法就可以寫成如下: | ||
| + | <code sh> | ||
| + | curl curl -F uploadfile=@/ | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | **主要的重點在於** | ||
| + | - 選擇檔案使用 **-F xxxx=@filepath** 來表示, **xxxx** 表示上傳的變數, | ||
| + | - url 內的參數內容出現空白要改用 %20 替代, 所以 2008-10-29 18:10:32 改用 \\ 2008-10-29%2018: | ||
| + | </ | ||
| + | |||
| + | ===== 參考網頁 ===== | ||
| + | * [[http:// | ||
| + | {{tag> | ||