Problem uploading
|
|
I have a problem uploading through the API, I get a 404 error. Here is my request as captured by fiddler: POST /upload/?title=mytitle& HTTP/1.1 Content-Type: multipart/form-data; boundary=----------8ca6ece17ec4bfa Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxx Accept: application/xml Host: heywatch.com Content-Length: 205411 Expect: 100-continue ------------8ca6ece17ec4bfa Content-Disposition: form-data; name="data"; filename="video.flv" Content-Type: application/octet-stream (file) Any idea what’s wrong? I have tested my upload code against my own php test upload page, and it works as expected, the file is uploaded.
<?php
print_r($_data);
$uploadDir = './';
$uploadFile = $uploadDir . $_FILES['data']['name'];
print "<PRE>";
if (move_uploaded_file($_FILES['data']['tmp_name'], $uploadFile))
{
print "File is valid, and was successfully uploaded. ";
}
else
{
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</PRE>";
?>
Response from heywatch:
HTTP/1.1 404 Not Found Server: nginx/0.5.32 Date: Thu, 17 Apr 2008 15:46:23 GMT Connection: keep-alive Content-Length: 0 What does a 404 mean when I upload? BTW, I have also tried upload.xml, same error. |
|
|
I found the error on my own, but nothing wrong with the header :) My code was wrong, the end boundary in the request was not followed by ”—”, although as mentioned it did work with my sample php code. I guess heywatch is more strict. nothing wrong with it though, as it is how it’s supposed to be done: See bottom of page: http://www.w3.org/TR/html4/interact/forms.html I have posted asp.net sample code in this heywatch thread http://forums.heywatch.com/forums/4/topics/92 as it was requested some working asp.net c# code. |
|
|
Great you found the error. Thank you for sharing your code. |