rejetto forum

HFS returning OK (200) to POST even when upload fails

dr_st · 2 · 2853

0 Members and 1 Guest are viewing this topic.

Offline dr_st

  • Occasional poster
  • *
    • Posts: 1
    • View Profile
Hi all,

I am a new user and found HFS when I was looking for a simple, light-weight HTTP server that I could test upload flows from my client.

Generally it worked well for me, and the server is a joy to configure and use. Great job! 8)

I noticed one thing that seemed strange to me. If I try to upload a file (using POST) without a proper permission configured, the file does not get uploaded, and the server reports "upload failed: not allowed". However, it still returns an OK (200) response to the client. Is that normal? If that's expected behavior from the server side, what should the client do to determine that the upload actually failed?

I am new to HTTP, so I wasn't sure whether it's a bug or normal behavior. That's why I opened it in the general forum.

Offline bmartino1

  • Tireless poster
  • ****
    • Posts: 901
  • I'm only trying to help i mean no offense.
    • View Profile
    • My HFS Google Drive Shared Link
you will probaly have to add a html code macro to give you soem more info:

some thing like this as seen form link above...

Html form code :

Code: [Select]
  <form><!---Removed form submit url-->
            <input type="text" id="keyName" value="testValue">
            <!---Id attribute added to input field to be submitted--->
            <input type="button" onclick="myFunction()" value="Submit">
            <!---Input type is button NOT submit--->

Javascript code:

Code: [Select]
function myFunction(){
var dataValue = $("#keyName").val();
            type : 'POST',
            //remove the .php from results.php.php
            url : "http://externalsite.cpm/results.php",
            //Add the request header
            headers : {
                Authorization : 'Bearer ' + 'XXXXXXXXXXXXXXXXXXXXXXXXX'
            contentType : 'application/x-www-form-urlencoded',
            //Add form data
            data : {keyName : dataValue},
            success : function(response) {
            error : function(xhr, status, error) {
                var err = eval("(" + xhr.responseText + ")");
        }); //End of Ajax
}   // End of myFucntion


more info aon addind data to the header:


REJETO has already answered this on a previous form post:

Re: Posting to HFS using Wfetch tool (HTTP Post) not saving file to folder
« Reply #9 on: August 31, 2015, 09:51:08 AM »
POST is generic. HFS needs data to be sent as "multipart", in the POST. That's what the browser does.
See if you have such option on your side.
« Last Edit: August 31, 2015, 09:59:15 AM by rejetto »
Files i try to keep and share can be found on my google drive: