Http post: always answer with the value 1

Hi all

I have this code below. I always have the value "1″ in return; No files, or other values...

This means that the value sent by 'POST' it always set to '1 '.

Where is the error?

Thank you very much!

var myFile = new File("C:/APPS/Test/temp.jpg");
var myLine = "";
authorization of var = "";

length of County

boundaryContent = "-1234\n";
boundaryContent += ' Content-Disposition: form-data; name = "upload"; filename = "'+ MyFile.Name +'" "+"\n";
boundaryContent += "Content-Type:"+ "image/jpeg" + "\n"; '.
boundaryContent += "\n";
myFile.open ("r");
myLine = myFile.read ();
boundaryContent += myLine;
myFile.close ();
boundaryContent += "\n";
boundaryContent += "- 1234 -" + "\n";

Alert ("calculate file size:" + boundaryContent.length);

County of end

conn1 = new Socket;

If (conn1.open ('127.0.0.1:8888', 'BINARY')) {}

conn1. Timeout = 9000;

conn1.writeln ("POST /Enterprise/config/plugins/NoWoodwing/servlet_temp.php HTTP/1.1");
conn1.writeln ("Host: 127.0.0.1:8888");
conn1.writeln ("Keep-Alive: 300");
conn1.writeln ("Connection: keep-alive");
conn1.writeln ("Content-Length:" + boundaryContent.length);

conn1.writeln ("Expect: 100-continue");
conn1.writeln ("Content-Type: multipart/form-data;") Boundary = 1234");
conn1.writeln("");
var boundaryContent1 = conn1.writeln("--1234");
boundaryContent1 += conn1.writeln ('Content-Disposition: form-data: name = "upload"; filename = "'+ myFile.name +'" ');
boundaryContent1 += conn1.writeln ("Content-Type:" + "image/jpeg");
boundaryContent1 += conn1.writeln("");
permission = conn1.readln ();
Alert ("Autorizzazione:" + permission);
If (permission == ' HTTP/1.1 100 continue') {}
If (myFile.open ("r")) {}
myLine = myFile.read ();
Alert ("Nuova linea:" + myLine);
boundaryContent1 += conn1.write (myLine);
myFile.close ();
}
}
boundaryContent1 += conn1.writeln("");
boundaryContent1 += conn1.write("--1234--");

Alert ("development of Post size file:" + boundaryContent1);

/*
var reply1 = ";
{while(!conn1.) EOF)}
reply1 += conn1.readln ();
};
Alert ("back:" + reply1);
*/

conn1. Close();

} else {alert ("error:" + conn1.error) ;}}

It works if you run the upload of file with another tool, such as a browser?

conn1 = new Socket;
if (conn1.open ("127.0.0.1:8888", "BINARY")) {
    conn1.timeout=9000;
    conn1.writeln("POST /Enterprise/config/plugins/NoWoodwing/servlet_temp.php HTTP/1.1");

Well, we certainly will be able to test that. Can you find an example of a server that is accessible to the public that accepts uploads and test against that?

Tags: InDesign

Similar Questions

  • HTTP POST will fail with the status code 400

    Hello

    I am trying to DISPLAY some data but my code still fails with code 400. I tried to change the URL and the method and adding different headers but I get the same answer. What I am doing wrong? My code is below.

    HttpConnection connection = null;
    DataOutputStream outputStream = null;
    
    try {
    connection = (HttpConnection) Connector.open(serverUrl);
                connection.setRequestMethod("POST");
                connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");            
    
                outputStream = connection.openDataOutputStream();
                outputStream.write(new String("test").getBytes());
    
                outputStream.flush();
                outputStream.close();                       
    
                if (connection.getResponseCode() == HttpConnection.HTTP_OK) {
                    isSuccess = true;
                } else {
                    failureMessage = "Error message " + connection.getResponseMessage();
                }
            } catch (IOException e) {
                failureMessage = "IOException: " + e.getMessage();
            } catch (Exception e) {
                failureMessage = e.getMessage();
            } finally {
                if (outputStream != null)
                    try {
                        outputStream.close();
                    } catch (IOException e) {
                        // Nothing to do
                    }
                if (connection != null)
                    try {
                        connection.close();
                    } catch (IOException e) {
                        // Nothing to do
                    }
            }
    

    In the end, the solution was to add "interface = wifi" at the end of the URL. I guess I'll have more problems when I switch to 3G, but for now it's ok.

    @Peter,

    I just wanted to say your responses in this forum have always been invaluable and led me to the right solutions. Your posts here and here were very useful to fix this that I had spent several hours on. So thanks a lot!

  • Why Firefox always opens with the last session tabs?

    When I open firefox always opens with the last session tabs? How can I solve this problem?

    You can check if you have a user.js file in the Firefox profile folder that affects the pref browser.sessionstore.resume_session_once true value.

    The user.js file is present than if you or another software has created this file and normally it wouldn't be here.
    You can check its contents with a text editor (right click: 'Open with'; do not double-click).
    The user.js file is read whenever Firefox is started and initializes the preferences to the specified value in this file, so the preferences set via user.js can be changed temporarily for the current session.

    You can remove the user.js file if you do not create this file yourself.

    You can use this button to go to the Firefox profile folder currently in use:

    Windows hides certain default file extensions.
    Among them are .html, .ini and .js, .txt, so you can see only file name without the file extension.
    You can see the type of actual file (file extension) in the properties of the file via the context menu in Windows Explorer.

  • No resources found that matches the name (to "android: textColorLink" with the value "@color/link_text_material_light")

    I downloaded adobe creative SDK for android and trying to check the demo app. But in the face of a problem described as below:

    If I compile project against target 23, then it shows no found resource that matches the name (to "android: textColorLink" with the value "@color/link_text_material_light"). It is corrected here https://github.com/fengdai/AlertDialogPro/issues/53 can you please use the most recent alert dialog library? Or any other solution to use the latest version of lib appcompat 23.1.1?

    I thank very you much for the quick response. I have posted the bug to Adobe Creative SDK

  • Firefox is not always compatible with the connection to my comcast email account. I need to clear the cache, and then I can back into my email account. Is there a way to permanently solve this problem? Thank you.

    Firefox is not always compatible with the connection to my comcast email account. I need to clear the cache, and then I am able to get back into my email account. Is there a way to permanently solve this problem? Thank you.

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Tools > Options > advanced > network > storage (Cache) offline: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Tools > Options > privacy > Cookies: "show the Cookies".
  • I need to set my Adobe Acrobat by default when I open PDF files. I've updated my adobe reader software and it changed my settings to always open with the reader. I still want to open it with Adobe Acrobat DC

    I need my Adobe Acrobat DC value by default when I open PDF files. I've updated my adobe reader software and it changed my settings to always open with the reader. I still want to open it with Adobe Acrobat DC

    Hello

    For windows, right click on the PDF? Open with > choose default program > set Acrobat DC as the default PDF Viewer and click OK.

    You could do the same thing in the control panel.

    Concerning

    Sukrit diallo

  • Creation of ComboBox with the values of the fields

    Hey everyone, it's been a while since my last post.

    I spent some time trying to fill a ComboBox with the values of the 3 fields of different form of google and I was wondering if someone could tell me on common sense.

    Thanks a lot for any idea!

    the general idea would be something like this:

    Get added to a table field values

    var aItems = [];

    aItems.push (getField("Text1").valueAsString);

    aItems.push (getField("Text2").valueAsString);

    aItems.push (getField("Text3").valueAsString);

    Fill the drop-down list with the elements box

    getField("combo1").setItems (aItems);

    Replace domain names with real field names that you use.

    You can start the list with an element that is a single space (if it appears empty) or something like "- select -". You can also make sure you add all the duplicate entries, which would happen if all the field values are the same.

    When did you want this script to run?

  • Siri in him sending text with the value 'NULL '.

    When I say, "Siri, text my wife, 'X', ' Siri responds correctly,"here is your message to Jill: 'X'. "" "  "Ready to send it?"  I say 'Yes' and sends the message.  As soon as I get a text from my carrier saying the recipient of the message was invalid.  100% of the time, I see that Siri has sent a text with the value NULL.

    I tried to restart my phone.  I tried to remove and re-add my contacts.  Anyone else having this problem?  Someone knows how to solve?

    If it's by the carrier, you should contact them and see what they receive in return for their side. Ive had Siri send messages for me and I have never seen this one IOS.

  • Fill an input array with the values from the worksheet

    Is it possible to fill an input array with the values to a text file or a spreadsheet? If so, how do you?

    Thanks to GerdW and all who responded. Fill a table control using a local variable with "The spreadsheet file read" as he entered works perfectly.

  • Show largest index in the array with the value 'True '.

    Hello

    Is it possible to show the maximum number of index with the value "true", as indicated under?

    I can show the value on what index series of 'real' ends with the function 'Table Max and Min', but when there
    a fake between these True, it shows that the index of the true left of the fake.

    I don't need to know the size of the table, because he must stay 8

    File is attached

    Hi Stef,

    Here you go:

  • How to remove empty entries in a table and replace them with the values of the instance?

    I have a table with values and spaces elements. I want to organize items such as table contains only values eliminating the empty spaces and re-organize the table with the values of cotimuous.  I use a bollean table to populate the items, so the bolleans to false fill the empty I don't want spaces. How can I program the above operation?

    Thank you

    Thank you for your solution, but I just found an easier way. INDEXING CONDITIONAL!. How I miss that. in any case, thanks...

  • Automatic updates (KB2656353 & KB2656370) always fails with the error code 0 x 643

    Automatic updates (KB2656353 & KB2656370) always fails with the error code 0 x 643 for several occations and continue to offer. Several attempts to install manually also failed. Help is very appreciated. Thanks: SEBUBE

    Automatic updates (KB2656353 & KB2656370) always fails with the error code 0 x 643 for several occations and continue to offer. Several attempts to install manually also failed. Help is very appreciated. Thanks: SEBUBE

    Try each of the methods of repair HERE. If none of these solves the problem, we'll go from there.

  • KB2518870 and KB2539636 always fail with the message Code 643 and has Code 66

    Security for Microsoft .NET Framework 4 updates on... Windows Vista... KB2518870 and KB2539636 always fail with the message Code 643 and Code 66 has.  I can't find these codes or the reasons for these failures.  This happened for well over a month now.  They are reported as of the important updates, but won't install but no problem with the other updates.  Should I be worried?  Is there a solution to this problem?

    Thank you, but it doesn't work anymore. CD don't has not given me the possibility to upgrade the existing installation, so I had to reinstall the system...
    Kind regards
    Ricardo
  • How to capture the time entry with the value 'default' as SYSDATE

    Hello

    I created "entry receipt" form by using wizard.

    Hidden CREATED_ON column is defined with the value 'default' as SYSDATE.

    However, it's only complete part of date, but time is not included when I discovered that in the report.

    Format under 'source' mask is defined as "MON-DD-YYYY HH24:MI:SS" during form entry.

    Under the column definition format mask is "HH24:MI:SS MON-DD-YYYY" under the report.

    Need help to fix this problem.

    I use APEX worm 4.2.6

    Thank you

    -Anand

    Is it viable to not include the column in the form of the APEX and have a default value to the column in the table?

    ALTER table my_table change created_on default sysdate;

  • I have a new computer and I can't allow it to Adobe Digital Editions because my Adobe ID is always associated with the old computer.   .

    I have a new computer and I can't allow it to Adobe Digital Editions because my Adobe ID is always associated with the old computer.    The old computer is not operable, so I can't use it allow for out of this computer.  I don't want to create a new Adobe ID, because I don't want to create a new email address just to do this and my email current is already associated with an Adobe ID

    1. Close all applications on the new device.
    2. Click Start > run.
    3. Open, type regedit in the text box and press ENTER. The Registry Editor opens.
    4. In the left pane of the registry editor, locate the following registry key: HKEY_CURRENT_USER\Software\Adobe\Adept
    5. Select the key of the follower.
    6. Choose file > export.
    7. In the export registry file dialog box, select the branch selected under export range. Enter a name and location for the backup registry key, and then click Save.
    8. Right click on the key to the follower, and then choose Remove.
    9. In the dialog box confirm the key deletion, click OK.
    10. Close the registry editor.
    11. Open Adobe Digital Editions and reauthorize.

Maybe you are looking for

  • Have multiple e-mail accounts. How to make an account by default when you use send to mail recipient?

    We have several email accounts. How to make one of the accounts the default sender address when we send a document to the recipient of the message? Or how can I change the order of the Thunderbird email accounts that they appear?

  • OfficeJet L7680 all-in-one

    I have a problem with my printer print does not correctly it is dark, then barely readable and dark again. I tried to uninstall it to add and delete mail it won't let me. I tried to uninstall programs where hp is said to uninstall and it will not be.

  • Manual/Guide to disassemble the Qosmio G10

    Hello Just a question. Does anyone have a good link or a guide for when you want to open the G10 Toshiba? I have no guarantee more and unforutnately, I believe that the graphics card is dead, but I just want to know that. Thank youBlunder

  • Digital and analog gain in Script mode

    Hello. 5422 module can change the voltage Vp-p order of 05:54 V. But when I use the property node - digital Gain, after setting the 1.1 V and return to its previous value (V 1.0) occurs the following error: And when generating a signal of amplitude o

  • Create a Subvi command library

    I do a user interface that runs different tests that involve some movement commands.  The movement controls are simply send a command string to a DLL file.  Is it possible that I can consolidate all my movement controls (like up, down, stop, pump, et