php
  • bash
  • curl
  • 2015-01-27 5 views -1 likes 
    -1

    내가 this link에 파일을 업로드 컬 사용하여 시도, 내 curl 명령 :컬 파일을 업로드 할 수 없습니다 (bash는)

    [email protected]:~# curl -F "[email protected]/tmp/updater.log" http://galihpa.tk/upload.php 
    <FORM method="post" name="upload" enctype='multipart/form-data'> 
    File : <input type="file" name="upload-file"><input type="submit" name="btnUploa 
    d" value="Upload"> 
    

    :

    curl -F "[email protected]/tmp/updater.log" http://galihpa.tk/upload.php 
    

    그 실행 후, 그것은 나에게이 준 이 코드의 전체 코드는 내

    <? 
        // untuk memindahkan file ke tempat uploadan 
        $upload_path = "upload/"; 
        // handle aplikasi : apabila folder yang dimaksud tidak ada, maka akan dibuat 
        if (!is_dir($upload_path)) { 
         mkdir($upload_path); 
        } 
        if (isset($_POST['btnUpload'])) { 
         $file = $_FILES['upload-file']['name']; 
         $tmp = $_FILES['upload-file']['tmp_name']; 
         // jika $file ada dan tidak kosong 
         if ((isset($file)) && ($file != "")) { 
          // handle apabila sudah ada file sama yang terupload, maka akan dibuat copynya 
          $uploadfile = (file_exists($upload_path.$file)) ? $upload_path." copy of ".$file : $upload_path.$file; 
          move_uploaded_file($tmp, $uploadfile); 
          if (chmod($uploadfile, 0775)) { 
           // tampilkan pesan sukses apabila berhasil mengupload file 
           echo "Sukses mengupload file"; 
          } else { 
           // tampilkan pesan gagal apabila tidak berhasil mengupload file 
           echo "Gagal mengupload file"; 
          } 
         } 
        } 
    ?> 
    <FORM method="post" name="upload" enctype='multipart/form-data'> 
    File : <input type="file" name="upload-file"><input type="submit" name="btnUpload" value="Upload"> 
    </FORM> 
    

    도와주세요.

    +0

    을 내가 생각 * * 당신은 당신이 컬로 통과 이름이 입력 필드의 이름이 아닌되고 싶어 form - like'curl -f [email protected]/tmp/updater.log http : // galipha.tk/upload.php' – TZHX

    +0

    은 여전히 ​​작동하지 않습니다. 명령에 오타가 있습니다. – Don

    +0

    예,'- F는'-f'가 아닙니다. 그게 효과가 있니? – TZHX

    답변

    1

    또한 같이 귀하의 처리 코드를 실행하는 데 btnUpload를 채울해야합니다 :

    curl -F "[email protected]/tmp/updater.log" -F "btnUpload=Upload" http://galihpa.tk/upload.php 
    
    관련 문제