File Upload HTTP with plug

Hello

I am currently working on scripts that use the Socket for HTTP communication with our server, I found a lot of answers to my question by conducting a search in the forum, but now I'm stuck with an HTTP download.

I create an overview of the current pages and I want to download this song on the server. The server runs a java application and I have a java application to download test files - I know that the download works and the problem is in the script.

I read the file into a string and I create a Socket connection to the server. I created another channel with the content to download (file and additional information), love and I send you the MESSAGE HTTP to the server. And I always get a "stream ended unexpectedly" error from the server.

So, I think, the length of the content is the problem. Server expects a number of bytes, and I do not send the bytes expected. How to calculate the length of the content?

This is my code:

conn = new Socket;

response = "";

var f = file ('c:\\tmp\\jdExport.jpg');

f.Encoding = "BINARY";

f.Open ("r");

var fContent = f.read ();

f.Close ();

If (conn.open ('127.0.0.1:8081', 'BINARY')) {}

Alert ("linked");

Conn.Timeout = 20000;

Content = "-XLuvdG51D_BRiiAda_0y79ImMN_ddtKYzeFFLlu8\n".

+ "Content-Disposition: form-data; name = \ 'file '; filename=\"jdExport.jpg\"\n ".

+ "Content-Type: application/octet-stream\n".

+ "\n"

+ the fContent;

;

CS = "POST/dp/uploadpreview? SessionID = xxxx HTTP/1.1\n.

+ "Content-Length:"+ content.length + "\n";

+ "Content-Type: multipart/form-data; Boundary = XLuvdG51D_BRiiAda_0y79ImMN_ddtKYzeFFLlu8\n.

+ "Host: 127.0.0.1:8081\n".

+ "Connection: Keep-Alive\n".

+ "User-Agent: Apache-HttpClient/4.3.1 (java 1.5) \n".

+ "Authorization: basic TXlTUUxcYWRtaW46\n.

+ "Accept-Encoding: gzip, deflate\n.

+ "\n"

+ content;

Journal of the var = file ("c:\\tmp\\log.txt");

log. Open ('w');

log. Write (cs);

log. Close();

Conn.Write (cs);

response = conn.read (999999);

Conn.Close ();

alert (response).

If (reply.indexOf ('200 OK') > 0) {}

} else {}

throw new Error ("createLayout.error: Errormessage of the server" + dataplanServer + ":" + getResponseError (answer) "");

}

} else {}

throw new Error ("createLayout.error: unable to connect to"+ dataplanServer ");

}

I found it. I downloaded the source files for the spring framework and the Commons of apache file upload und used the debugger to find out what happened on the server side. Want it tomcat on the other '-' after the file data (and closed chain limit) and I got a CRLF in this position. I just added the "-" at the end of the upload and it worked...

Tags: InDesign

Similar Questions

  • How can I use an external HTML form with a file upload in my page of MUSE?

    How can I use an external HTML form with a file upload in my page of MUSE? I know I can insert an external form, but how do I create a link to my email

    Yes, in most cases. If it is not in your actual embed code, you will need to be added to the script that uses the code. There are literally hundreds of form manages the codes out there on the web, it would be impossible to tell you exactly where it needs to be added. Your best option is to use a third party such as JotForms or WooForms shape provider and use the third Muse Widgets for these services.

  • How to share files uploaded in the creative cloud with other members of creative cloud?

    How to share files uploaded in the creative cloud with other members of creative cloud?

    Should be easy.  Try this...

    1. In thumbnail view, click the small triangle (pointing down) in the lower right corner of the asset you want to share.
    2. On the blue icon toolbar that appears, click on the share icon (the third icon from the left, just to the right of the trash icon). The sharing dialog box should appear.
    3. In the sharing dialog box, enter the e-mail address of the person with whom you want to share assets, then click on the button send an email - it will receive an email with a link to your assets. OR
    4. You can also copy a link to the asset and paste that in your own e-mail client if you wish.  To do this, click on the link icon (looks like a 'chain' and to the right of the icon to email "envelope")-then click on the button, copy the link.

    Note that stock options are not available if your asset is set to 'Private' - you can control if an asset can be seen (or downloaded) by others by clicking the control Public/private (green or red icon "lock").

    You can also access the same controls hand, if you click on the file to see him score a point (you can do display thumbnails or list view); Click on the share icon near the top right of the window of the browser (to the right of the name of the asset).

    Hope that helps.

  • Purchase order customized with ease of file upload

    Hi all

    I am trying to create a purchase order (for a printing company) where the user can select his product, enter credit card details and then download the file. I created the combo box & user text entry fields. Now what I want is that when the user clicks the Send button:

    1. a mail is sent to the administrator which contain all of the details on the form was filled in by the user.

    2. the file that is downloaded by the user should also be sent as an attachment in the same mail. I am not able to figure out how to add the ActionScript file upload feature.

    3. This is optional, but will bring added value to me if possible. The site is developed on Wordpress. Can we have a feature where a user can save his order and come later and retrieve his purchase order.

    Any help would be appreciated. Thanks for your time.

    Kind regards

    Rajeev

    your customer is, in my view, legally negligent.  You probably are jointly and severally responsible with your customer.

    You should try and protect you.  You must keep a record that you told him that he needs to encrypt all numbers credit card during all phases of the transmission but I doubt that will be enough to protect you because you are able to know and come out, it is fulfilling its obligations to protect sensitive information.

    you use the urlloader class to communicate between flash and the server, and you will probably use php (other language encoding) for coding on the side server.

    You can use google to search for help and tutorials php.

  • Several files & amp; Upload image with the developers tool box

    I am considering buying the box tools to developers if she will allow me to save some time. Online information is very detailed, and I'm curious to know if it has multiple downloads of image management capabilities. For example, I am building a news page where an article contains several images. What is not in the Toolbox developer tools or am I better just hand coding?

    multiple image upload (with optional resizing) and file upload features are available in the MEASURE when you use the PHP_MySQL server model - without hand coding.

  • I lost the top bar with my file and edit with cut, copy and paste functionality

    I lost the bar with the following functions: file, edit them with cut, copy and paste

    See-> https://support.mozilla.com/en-US/kb/common-questions-after-upgrading-firefox-36#w_why-are-the-menus-file-edit-view-etc-missing

    Also on the menu of the Firefox button, the Edit option is there. 3 after the word 'Edit' icon will be "not gray" if something is highlighted on the page, or something already exists on the Clipboard. The "arrow" to the right of the Edit will give you the options of text instead of icons.

    Other frequently asked questions after the upgrade: https://support.mozilla.com/en-US/kb/common-questions-after-upgrading-firefox-36

    You must upgrade to a newer version than the Firefox 4 with the included information in your question that you are using.

    Not related to your question, but...

    You may need to update some plug-ins. Check your plug-ins and update if necessary:

  • I can not find, select, install the appropriate SR2 extended RAW for Phtoshop CS6 file to use with my Canon 5DSR camera... Please help

    I can not find, select, install the appropriate SR2 extended RAW for Phtoshop CS6 file to use with my Canon 5DSR camera... Please help

    Hi drdrum,

    Greetings!

    Update the software of camera raw as Canon 5DSR is supported camera raw version 9.0 and above.

    Here is the download link: https://helpx.adobe.com/x-productkb/multi/update-error-u43m1d204.html

    Also, here is the list that displays the camera with respective camera raw support:https://helpx.adobe.com/camera-raw/kb/camera-raw-plug-supported-cameras.html

    Concerning

    Jitendra

  • File.upload ActionScript does not work on Air SDK for iOS devices

    I try to use the ActionScript File.upload to transfer a file on Air SDK for iOS environment, but the File.upload does not work properly. No event on the file upload handler is executed after File.upload is called, and no exception is caught. When I check the side network traffic server, I found no application http even didn't hit the server after execution of File.upload. The code is below.

    ------------------------------------------------------------------------------------------ -----------------------------------------------------------------------

    <? XML version = "1.0" encoding = "utf-8"? >

    " < = xmlns:fx s:View ' http://ns.Adobe.com/MXML/2009 "xmlns:s ="library://ns.adobe.com/flex/spark"title ="HomeView"> "

    < fx:Declarations >

    <! - Place non-visual elements (e.g., services, items of value) here - >

    < / fx:Declarations >

    < fx:Script >

    <! [CDATA]

    private var file:File;

    private var dir:File;

    This method is executed to create a file and download it when you press the download button.

    protected void OnUploadButtonPressed(event: MouseEvent): void {}

    trace ("upload button clicked");

    var urlReq:URLRequest = new URLRequest ("http://10.60.99.31/MyPath/fileUploadTest.do");

    urlReq.method = URLRequestMethod.POST;

    var str:String = "this is test";

    var imageBytes:ByteArray = new ByteArray();

    for (var i: int = 0; i < str.length; i ++) {}

    imageBytes.writeByte (str.charCodeAt (i));

    }

    trace ("size =" + imageBytes.length);

    try {}

    dir = File.applicationStorageDirectory

    I also tested in several different directories

    dir = File.createTempDirectory ();

    dir = File.documentsDirectory;

    var today: Date = new Date();

    var filename:String = 'IMG' + now.fullYear + now.month + now.day + now.hours + now.minutes + now.seconds + now.milliseconds + ".txt";

    file = dir.resolvePath (filename);

    var stream: FileStream = new FileStream();

    Stream.Open (file, FileMode.WRITE);

    stream.writeBytes (imageBytes);

    Stream.Close ();

    Review the content of the file to check if the file is written successfully.

    var readStream:FileStream = new FileStream();

    readStream.open (file, FileMode.READ);

    var: string result = readStream.readUTFBytes (readStream.bytesAvailable);

    trace ("rear read result =" + result); The result is shown here as planned.

    file.addEventListener (Event.COMPLETE, uploadComplete);

    file.addEventListener (IOErrorEvent.IO_ERROR, ioError);

    file.addEventListener (SecurityErrorEvent.SECURITY_ERROR, securityError);

    file.addEventListener (ErrorEvent.ERROR, someError);

    file.addEventListener (ProgressEvent.PROGRESS, onProgress);

    file.upload (urlReq); This line does not work. No handler is executed. No http request struck the coast server.

    trace ("after file upload test");

    } catch (error) {}

    trace (e);

    }

    }

    Complete Manager

    private function uploadComplete (event: Event): void

    {

    trace ("Upload successful.");

    }

    IOError handler

    private void ioError (error: IOErrorEvent): void

    {

    trace ("Upload failed:"+ error.text ");

    }

    Manager SecurityError

    private void securityError(error:SecurityErrorEvent):void {}

    trace ("security error:" + error.text);

    }

    Another Manager

    private void someError(error:ErrorEvent):void {}

    trace ("an error" + error.text);

    }

    Progress Manager

    private void onProgress(event:ProgressEvent):void {}

    trace ("progressHandler");

    }

    This method is executed to call the URLLoader.load when the delicate touch.

    protected void OnTrickyButtonPressed(event: MouseEvent): void {}

    var urlReq:URLRequest = new URLRequest ("http://200.60.99.31/"); This points to a server not - exist

    urlReq.method = URLRequestMethod.POST;

    urlReq.data = new ByteArray();

    var loader: URLLoader = new URLLoader();

    try {}

    Loader.Load (urlReq); This line is very important in iOS7. He decides if the latter file.upload may work.

    But in iOS8, file.upload does not work even if that line is executed.

    trace ("after urlloader load");

    } catch (error) {}

    trace (e);

    }

    }

    []] >

    < / fx:Script >

    < s:Button = "200" x = "200" width = "400" height = "200" label = "Upload" click = "OnUploadButtonPressed (event)" / > "

    < s:Button = "200" x = "500" width = "400" height = "200" label = "Tricky" click = "OnTrickyButtonPressed (event)" / > "

    < / s:View >

    ------------------------------------------------------------------------------------------ -----------------------------------------------------------------------


    When it is run on the simulator of the Air, it works very well as expectedand the file is successfully downloaded to the server. But when run on iOS devices (in my case, iPad), as I explained at the beginning, no event on the file upload handler is executed and not the http request has even hit the server. So I think that the problem may come from the client side.

    During my attempt to solve the problem, I found something complicated about this problem on iOS7. In other words, if you call the URLLoader.load method (although the URLLoader.load points to an address non-existed) before calling the File.upload method, the File.upload will work as expected on iOS7. Specifically, when the above OnTrickyButtonPressed method is run before the OnUploadButtonPressedmethod, File.upload will succeed on iOS7. But this only happens on iOS7. On iOS8, File.upload still refuses to work, regardless of knowing if the URLLoader.load is executed before.

    I think in my case, the problem is not the problem of sandbox or a session of Firefox problem described in the two links below, because not even a http request hit the side server. It seems that the Air SDK for iOS comes to fail send the http reason request any.

    http://StackOverflow.com/questions/5967382/Flex-4-FileReference-issues-with-Firefox

    http://StackOverflow.com/questions/351258/how-do-i-make-Flex-file-upload-work-on-Firefox-a nd-safari

    To make my problem clear, I list my environment below:

    • Development environment: Windows7 (64-bit) / Mac os 10.9.4 (tested on both OS platforms.)
    • IDE: Flash Builder 4.7
    • Air SDK: 3.8 / 16.0.0 (after that I have updated to the latest Air SDK 16.0.0, problem persists.)
    • Application server: Tomcat7 + spring

    Finally, I want to mention that download the file using URLLoader.load isn't an option in my case because I want to download large files in the future, which cannot be addressed with the URLLoader.load.

    I struggled with this for days. If I really appreciate it if anyone has an idea about this.

    Thanks in advance.

    Hi KA RYU.

    We have reproduced the issue successfully, our team would work on it.

    -Tushar

  • A secure file upload

    I would like to use APEX to our project, but I don't know if it is possible to download files safely with it.

    (1) how does the file upload widget? I find file, I click on send, how it is transferred after that? By establishing the ftp connection and use it to transfer the file? Or through HTTP?

    (2) my second question is more convenient. I make sure that this download is secure. To confirm the HIPA requirements, the transfer must be encrypted (as if I used ftps Protocol). Is there a way to add encryption to the default file upload feature? Otherwise, any workaround?

    Very much appreciated.
    -John

    Hi John,.

    I did not know you if you're looking for a hosted solution. The statement you received from Revion.com says that they provide no file secure - and transfer of content for your APEX applications. They have also mentioned the SSL options for hosted environments (shared for a shared domain certificate) or IP dedicated for an area customized with a personalized certificate.
    I would say that your condition will be fulfilled then.

    -Udo

  • Download files and HTTP service

    Hi all

    I have a problem in the communication of the return values after the upload of a file. I have my flex with HTTP Service registered application that is my servlet server-side. When I am in normal event processing, all right. In my mxml file I have:

    < mx:HTTPService id = "textRequest".
    method = "post".
    ' URL =' http://localhost: 8080/myservice "
    useProxy = "false".
    resultFormat = "e4x".
    result = "OnResult (Event); »
    Fault = "onFault (Event); ' invoke = "onInvoke (event)" >
    < / mx:HTTPService >

    Result method is recorded and it is treat all my data server. But this method is not invoked when I file upload, clues why? After downloading files, I need to communicate the contents of the downloaded file in turn, and I just wanted to put this in the response from the server. Just for the record, next to this file upload works fine.

    Thanks for the help,
    See you soon

    Hello

    I think I found the solution of optmial for me. In my case, I didn't have to double the number of communicates, so here it is, all download event data and a code for this example:

    dispatcher.addEventListener (DataEvent.UPLOAD_COMPLETE_DATA, uploadCompleteDataHandler);

    private void uploadCompleteDataHandler(event:DataEvent): void {}

    var result: XML = new XML (event.data);
    dataString = result.data.@text;

    }

    Event.Data contains 'raw server rΘponse' so that you can retrieve your data from there.

    Thanks for your help :)

    P.S. I found some info on it here:
    http://www.dgrigg.com/post.cfm/08/02/2007/Flex-and-Flash-file-uploading-with-return-data

  • Same html file seen locally on the laptop seems different from the same file uploaded to the server why?

    I create a file local html with CSS style sheets, etc. I see locally and he looks at the way in which it is intended, when I download and see from a domain to a server, same look of bigger files. This includes images, fonts, etc.. I even tried to reset firefox without result, but since it's the same file, I am just posting locally and online, there should be no reason for these differences. OS is Vista Home Premium, Mozilla Firefox 3.6.13.

    Reset the page zoom on pages that cause problems: view > Zoom > reset (Ctrl + 0 (zero); Cmd + 0 on Mac)

  • Could you please tell me the name of the program that plays the files (mp3) begins with V and resembles a cone orange and white?

    Could you please tell me the name of the program that plays the files (mp3) begins with V and resembles a cone orange & white?

    VLC.

    http://www.videolan.org/VLC/

  • DFSR and files that begin with numbers

    I have a DFSR configuration and it works fine except that when I went to check if all files have been sync'd I noticed none of the files that begin with a number are replicated from the original host to the new.

    It is the filter that is in place:
    ' ~ *, master, *.tmp.
    That should not exclude these files.
    TIA
    -> brian

    Hello

    Thanks for asking this question to Microsoft Community.

    I would recommend posting your query in the TechNet Forums. The community of IT professionals in the following TechNet forum will be able to help you the best.

    http://social.technet.Microsoft.com/forums/en/winserverfiles/threads

    Hope this information is helpful and let us know if you need more assistance. We will be happy to help.

  • How to remove files that end with the period (.)

    I have a file that ends with a period (.). The latter, after trying to remove it, he says that his source was not found. Well, then I looked and he says its because of the dowry, but I couldn't find answers on how to fix this. Is there a way?

    I run Windows XP 32-bit.
    I'm surprised Unlocker didn't work. See if that helps.
    http://blog.dotsmart.NET/2008/06/12/solved-cannot-read-from-the-source-file-or-disk/
     
     
  • TMP files automatically open with

    I clicked the always open this type of file with the function 'open with' option to open a TMP file created by my Canon ZoomBrowser and now I can't stop all the TMP files to open in my desktop photo manager. How to stop?

    Hey Timmy,

    Thanks for posting your query in Microsoft Community and we can help you with your problem.

    According to the description of the problem you are facing problems with file associations and files always open with TMP file in the desktop image handler.

    I suggest to follow the steps in the article mentioned below and check to see if that does the trick:

    How to change or choose the program that starts when you double-click a file in Windows XP

    http://support.Microsoft.com/kb/307859

    Hope this information helps. For any other corresponding Windows help, do not hesitate to contact us and we will be happy to help you.

Maybe you are looking for