Upload files using Snoopy

2008-09-26
2013-05-30
  • Mihai Grigori
    Mihai Grigori
    2008-09-26

    I've been trying to use Snoopy (v 1.2.3) to upload a file along with some other regular form fields.

              $file = "/home/mihai/my_file.gz";
              $c = new Snoopy();
              $c->set_submit_multipart();         
              $c->submit($request_url, $parameters, array('file1[uploaded_data]'=>$file));

    This was returning a 505 error from the server where I was trying to upload.
    After doing some investigations I've came to the conclusion that this was happening because, before sending the content of the gzipped file the mime content time should have been specified.

    i.e. instead of:
    --Snoopy543346f3a76ab16315fc0cc89f0af469
    Content-Disposition: form-data; name="file1[uploaded_data]"; filename="my_file.gz"

    ���....

    should have been:
    --Snoopy543346f3a76ab16315fc0cc89f0af469
    Content-Disposition: form-data; name="file1[uploaded_data]"; filename="my_file.gz"
    Content-type: application/gzip   

    ���....

    or:
    --Snoopy543346f3a76ab16315fc0cc89f0af469
    Content-Disposition: form-data; name="file1[uploaded_data]"; filename="my_file.gz"
    Content-type: application/octet-stream   

    ���....

    Does this make sense to you? If so - will this reach the developers of this project or should I submit this somewhere else?

    Thanks

     
    • Mihai Grigori
      Mihai Grigori
      2008-09-26

      correction: not a '505' error but a '500' error