HTTP Post of big files over UMTS stops

Hi there I modified the code from [this thread|http://forum.java.sun.com/thread.jspa?forumID=256&threadID=451245] to suit the needs of J2ME:
package some.package.util.http;
* Original source code: http://forum.java.sun.com/thread.jspa?forumID=256&threadID=451245
* This source was adapted to meet the requirements of J2ME
* @author tb
import java.io.*;
import java.util.Enumeration;
import java.util.Vector;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.microedition.io.file.FileConnection;
* <code>MultiPartFormOutputStream</code> is used to write
* "multipart/form-data" to a <code>javax.microedition.io.HttpConnection</code> for
* POSTing.  This is primarily for file uploading to HTTP servers. 
public class MultiPartFormOutputStream {
* The line end characters. 
private static final String NEWLINE = "\r\n";
* The boundary prefix. 
private static final String PREFIX = "--";
* The output stream to write to.
private DataOutputStream out = null;
* The multipart boundary string. 
private String boundary = null;       
private Vector progressListeners;
* Creates a new <code>MultiPartFormOutputStream</code> object using
* the specified output stream and boundary.  The boundary is required
* to be created before using this method, as described in the
* description for the <code>getContentType(String)</code> method. 
* The boundary is only checked for <code>null</code> or empty string,
* but it is recommended to be at least 6 characters.  (Or use the
* static createBoundary() method to create one.)
* @param  os        the output stream
* @param  boundary  the boundary
* @see  #createBoundary()
* @see  #getContentType(String)
public MultiPartFormOutputStream(OutputStream os, String boundary) {
if(os == null) {
throw new IllegalArgumentException("Output stream is required.");
if(boundary == null || boundary.length() == 0) {
throw new IllegalArgumentException("Boundary stream is required.");
this.out = new DataOutputStream(os);
this.boundary = boundary;
this.progressListeners=new Vector();
* Writes an boolean field value. 
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String name, boolean value)
throws java.io.IOException {
writeField(name, new Boolean(value).toString());
* Writes an double field value. 
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String name, double value)
throws java.io.IOException {
writeField(name, Double.toString(value));
* Writes an float field value. 
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String name, float value)
throws java.io.IOException {
writeField(name, Float.toString(value));
* Writes an long field value. 
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String name, long value)
throws java.io.IOException {
writeField(name, Long.toString(value));
* Writes an int field value. 
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String name, int value)
throws java.io.IOException {
writeField(name, Integer.toString(value));
* Writes an short field value.
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String name, short value)
throws java.io.IOException {
Short val = new Short(value);
writeField(name, val.toString());
* Writes an char field value. 
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String name, char value)
throws java.io.IOException {
writeField(name, new Character(value).toString());
* Writes an string field value.  If the value is null, an empty string
* is sent (""). 
* @param  name   the field name (required)
* @param  value  the field value
* @throws  java.io.IOException  on input/output errors
public void writeField(String fieldName, String value)
throws java.io.IOException {
if(fieldName == null) {
throw new IllegalArgumentException("name cannot be null or empty.");
if(value == null) {
value = "";
String contentDisposition = "Content-Disposition: form-data; name=\"" + fieldName + "\"";
--boundary\r\n
Content-Disposition: form-data; name="<fieldName>"\r\n
\r\n
<value>\r\n
// write boundary
out.write(PREFIX.getBytes());
out.write(boundary.getBytes());
out.write(NEWLINE.getBytes());
// write content header
out.write(contentDisposition.getBytes());
out.write(NEWLINE.getBytes());
out.write(NEWLINE.getBytes());
// write content
out.write(value.getBytes());
out.write(NEWLINE.getBytes());
//out.flush();
* Writes a file's contents.  If the file is null, does not exists, or
* is a directory, a <code>java.lang.IllegalArgumentException</code>
* will be thrown. 
* @param  name      the field name
* @param  mimeType  the file content type (optional, recommended)
* @param  file      the file (the file must exist)
* @throws  java.io.IOException  on input/output errors
public void writeFile(String fieldName, String mimeType, FileConnection fileCon)
throws java.io.IOException {
if(fileCon == null) {
throw new IllegalArgumentException("File cannot be null.");
if(!fileCon.exists()) {
throw new IllegalArgumentException("File does not exist.");
if(fileCon.isDirectory()) {
throw new IllegalArgumentException("File cannot be a directory.");
writeFile(fieldName, mimeType, fileCon.getPath(), fileCon.openDataInputStream());
* Writes a input stream's contents.  If the input stream is null, a
* <code>java.lang.IllegalArgumentException</code> will be thrown. 
* @param  name      the field name
* @param  mimeType  the file content type (optional, recommended)
* @param  fileName  the file name (required)
* @param  is        the input stream
* @throws  java.io.IOException  on input/output errors
public void writeFile(String fieldName, String mimeType,
String fileName, InputStream is)
throws java.io.IOException {
if(is == null) {
throw new IllegalArgumentException("Input stream cannot be null.");
if(fileName == null || fileName.length() == 0) {
throw new IllegalArgumentException("File name cannot be null or empty.");
String contentDisposition = "Content-Disposition: form-data; name=\"" + fieldName +
"\"; filename=\"" + fileName + "\"";
String contentType = "Content-Type: " + mimeType;
--boundary\r\n
Content-Disposition: form-data; name="<fieldName>"; filename="<filename>"\r\n
Content-Type: <mime-type>\r\n
\r\n
<file-data>\r\n
// write boundary
out.write(PREFIX.getBytes());
out.write(boundary.getBytes());
out.write(NEWLINE.getBytes());
// write content header
out.write(contentDisposition.getBytes());
out.write(NEWLINE.getBytes());
if(mimeType != null) {
out.write(contentType.getBytes());
out.write(NEWLINE.getBytes());
out.write(NEWLINE.getBytes());
// write content
byte[] data = new byte[1024];
int r = 0;
while((r = is.read(data, 0, data.length)) != -1) {
out.write(data, 0, r);
this.updateProgressListeners(data.length);
// close input stream, but ignore any possible exception for it
try {
is.close();
} catch(Exception e) { e.printStackTrace();}
out.write(NEWLINE.getBytes());
//out.flush();
* Writes the given bytes.  The bytes are assumed to be the contents
* of a file, and will be sent as such.  If the data is null, a
* <code>java.lang.IllegalArgumentException</code> will be thrown. 
* @param  name      the field name
* @param  mimeType  the file content type (optional, recommended)
* @param  fileName  the file name (required)
* @param  data      the file data
* @throws  java.io.IOException  on input/output errors
public void writeFile(String fieldName, String mimeType, String fileName, byte[] data)
throws java.io.IOException {
if(data == null) {
throw new IllegalArgumentException("Data cannot be null.");
if(fileName == null || fileName.length() == 0) {
throw new IllegalArgumentException("File name cannot be null or empty.");
String contentDisposition = "Content-Disposition: form-data; name=\"" + fieldName +
"\"; filename=\"" + fileName + "\"";
String contentType = "Content-Type: " + mimeType;
--boundary\r\n
Content-Disposition: form-data; name="<fieldName>"; filename="<filename>"\r\n
Content-Type: <mime-type>\r\n
\r\n
<file-data>\r\n
// write boundary
out.write(PREFIX.getBytes());
out.write(boundary.getBytes());
out.write(NEWLINE.getBytes());
// write content header
out.write(contentDisposition.getBytes());
out.write(NEWLINE.getBytes());
if(mimeType != null) {
out.write(contentType.getBytes());
out.write(NEWLINE.getBytes());
out.write(NEWLINE.getBytes());
// write content
out.write(data, 0, data.length);
out.write(NEWLINE.getBytes());
//out.flush();
* Flushes the stream.  Actually, this method does nothing, as the only
* write methods are highly specialized and automatically flush. 
* @throws  java.io.IOException  on input/output errors
public void flush() throws java.io.IOException {
out.flush();
* Closes the stream.  <br/>
* <br/>
* <b>NOTE:</b> This method <b>MUST</b> be called to finalize the
* multipart stream.
* @throws  java.io.IOException  on input/output errors
public void close() throws java.io.IOException {
// write final boundary
out.write(PREFIX.getBytes());
out.write(boundary.getBytes());
out.write(PREFIX.getBytes());
out.write(NEWLINE.getBytes());
out.flush();
out.close();
* Gets the multipart boundary string being used by this stream. 
* @return  the boundary
public String getBoundary() {
return this.boundary;
* Creates a new <code>javax.microedition.io.HttpConnection</code> object from the
* specified <code>String</code>.   
* @return  a <code>javax.microedition.io.HttpConnection</code> object for the URL
* @throws  java.io.IOException  on input/output errors
public static HttpConnection createConnection(String url)
throws java.io.IOException {
HttpConnection conn = (HttpConnection) Connector.open(url);
conn.setRequestMethod(HttpConnection.POST);
return conn;
* Creates a multipart boundary string by concatenating 20 hyphens (-)
* and the hexadecimal (base-16) representation of the current time in
* milliseconds. 
* @return  a multipart boundary string
* @see  #getContentType(String)
public static String createBoundary() {
return "--------------------" +
Long.toString(System.currentTimeMillis(), 16);
* Gets the content type string suitable for the
* <code>javax.microedition.io.HttpConnection</code> which includes the multipart
* boundary string.  <br/>
* <br/>
* This method is static because, due to the nature of the
* <code>javax.microedition.io.HttpConnection</code> class, once the output stream
* for the connection is acquired, it's too late to set the content
* type (or any other request parameter).  So one has to create a
* multipart boundary string first before using this class, such as
* with the <code>createBoundary()</code> method. 
* @param  boundary  the boundary string
* @return  the content type string
* @see  #createBoundary()
public static String getContentType(String boundary) {
return "multipart/form-data; boundary=" + boundary;
public Enumeration getProgressListeners() {
return progressListeners.elements();
public void addProgressListener(ProgressListener pl) {
this.progressListeners.addElement(pl);
private void updateProgressListeners(int length) {
for(int i = 0;i<this.progressListeners.size();i++)
ProgressListener p = (ProgressListener) this.progressListeners.elementAt(i);
try {
p.updateProgress(length);
}catch(IllegalArgumentException ex)
ex.printStackTrace();
private void initProgressListeners(int maxValue)
for(int i = 0;i<this.progressListeners.size();i++)
ProgressListener p = (ProgressListener) this.progressListeners.elementAt(i);
p.setMaximum(maxValue);
{code}
Modifications I made:
* Use javax.microedition.io.HttpConnection instead of URLConnection
* Use String.getBytes() as DataOutputStream.writeBytes(String s) is not available in MIDP
* Use FileConnection from JSR-75 FileConnection API
I use it like this:
{code:java}
String boundary = MultiPartFormOutputStream.createBoundary();
//        this.httpCon.setRequestProperty("Accept", "*/*");
this.httpCon.setRequestMethod(HttpConnection.POST);
this.httpCon.setRequestProperty("Content-Type", MultiPartFormOutputStream.getContentType(boundary));
this.httpCon.setRequestProperty("Connection", "Close");
//          this.httpCon.setRequestProperty("Cache-Control", "no-cache");
this.multipartOutput = new MultiPartFormOutputStream(this.httpCon.openDataOutputStream(), boundary);
if(this.progressListener!=null)
this.multipartOutput.addProgressListener(progressListener);
this.multipartOutput.writeField("hwid", "");
this.multipartOutput.writeField("lang", "de-de");
this.multipartOutput.writeField("guilang","en-gb");
this.multipartOutput.writeField("hwid", "0000000DECAF");
this.multipartOutput.writeField("actcode", "masterKey");
this.multipartOutput.writeField("x1", "-1");
this.multipartOutput.writeField("y1", "-1");
this.multipartOutput.writeField("x2", "-1");
this.multipartOutput.writeField("y2", "-1");
this.multipartOutput.writeFile("img", "image/jpeg", "testbild.jpg", dataInputStream);
this.multipartOutput.close();
this.httpCon.close();
{code}
While the code seems to work well with GPRS, I experienced problems with UMTS.
Here are my test results:
||Device||K850i||W910||W910||K850i||K850i||W910||
|Java Plattform|JP-8|JP-8|JP-8|JP-8|JP-8|JP-8|
|Dataservice|GPRS|GPRS|GPRS|GPRS|UMTS|UMTS|
|Carrier|O2-DE|O2-DE|Vodafone-DE|Vodafone-DE|Vodafone-DE|Vodafone-DE|
|Filesize (Byte)|1.428.077|1.428.077|1.428.077|1.428.077|1.428.078|1.428.079|
|Upload (Byte)|complete|complete|complete|complete|184320 (113664)|627712 (199680)|
The problem of partial upload seems only to exist with larger Files (not sure where exactly the lower bound is).
I hope this was not too much information for a start, but I am currently quite desperate about this bug.
I could really use some help here. I will also provide you with the results of a test on Nokia S60 phones
and the results of SE on device debugging.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

The issue was solved by a firmware upgrade [jumpingjoy]
Must have been a problem with JP-8. Works as expected on JP-8.2 now.
||Device|K850i|     W910|
||Firmware     |R1EA037     |R1EA033|
||Java Plattform     |JP-8.2     |JP-8.2|
||Dataservice     |UMTS     |UMTS|
||Carrier     |Vodafone     |Vodafone|
||Filesize (Byte)     |1.428.077     |1.428.077|
||Upload (Byte)     |complete     |complete|
HTH
Edited by: er4z0r on 15.04.2008 17:55
Edited by: er4z0r on 15.04.2008 17:56
Edited by: er4z0r on 15.04.2008 17:58

Similar Messages

  • WIFI dies when transferring big files over the network

    Hi, I have Dell Inspiron 1520 with ipw3945 driver, when I transfer big files over the network, my wifi dies, anybody knows what could it be? If you need additional information, feel free to ask...
    Thanks in advance

    I guess we shall see. I can't imagine we are the only 7 with these issues.  Mine is mainly just lag... and overall slowness.  I hope to work through this.  If it lasts much longer I will have to revert back all 3 of my lappies to FC which I really do not want to do.  But on the lappies i connect via wireless 90% of the time and need it to work. 
    By the way how are you guys configuring your wifi?  I am using the iwl drivers and wicd.
    Well I did some more testing and loaded up netcfg and still get the same results so that rules out that part.  I also did some packet captures and I am getting a bunch of tcp retransmissions followed by tcp segment lost followed by a reset which in turn kills my rdp session (remote desktop protocol). I also went back several versions of the uucode driver and still get the same reults so I guess it seems to be a kernel issue.  Back to FC I go.  Damn shame...
    Last edited by BKJ (2008-10-08 01:08:56)

  • Can't upload big files (over 250-300MB)

    Upload just stop's in different states. Same problem in ff 34, and 37.0.2 (Linux).
    This problem occurs on google drive or similar services (disk.yandex.ru, cloud.mail.ru).
    Hope you will understand my runglish.

    I would try the version of FF available on our site. https://www.mozilla.org/en-US/firefox/all/ (Note: I do not recommend using the 64-bit version at this time, even if your OS is 64-bit.)
    If that doesn't work, try posting on some Slackware forums to see if anyone else on Slackware 14.0 is having this issue. Right now there haven't been any other reports of this, so I don't think it is affecting the more mainstream operating systems.
    Wish I could offer more help.

  • Data Flow | XML Source | Very Slow with big files (over 1/2 a gig)

    hi
    I am trying to load a few XML files to a database. one of our proprietary systems load the file in 3-4 minutes however with ssis XML source file it takes over an hour.
    can anyone know the reason/help with this?
    I tried the delayValidation set to true with no success.
    thanks
    eddy
    eddy.a

    Parsing XML files as data sources in SSIS is not the most efficient. Remember that you have define a WSDL (aka structure of the input file) and once the XML source starts parsing the input file, it has to read every node at every level and make sure it conforms
    to the structure defined in the WSDL file before it can start streaming the data out to the downstream components in your workflow.
    A half-gig XML file with 150 nodes to parse is going to need some heavy-lifting behind the scenes before you start seeing the rows streamed out. I'd rather recommend that you use either inbuilt .Net classes for XML to parse and extract the data or leverage
    SQL scripting to accomplish that. Alternatively, if your upstream system can instead drop the data feed in a flat file format, that'd be more preferable. And if you could hook into their data streaming APIs/end-points directly, that'll work too.
    Hope this gets you started in finding the right approach.
    - Muqadder.

  • Flat file over HTTP or SOAP

    Hey Guys,
    I need to post a Flat file over HTTP (or SOAP), is this possible without developing my own Adapter module?
    I just need to get a Flat file from a FTP server and post to another server via HTTP,since there is no message mapping involved, i developed the scenario without any Integration Repository objects, it is just a pass-through scenario.
    Now i am stuck on the receiver side since i am unable to post Flat file over HTTP.
    Secondly i have Login URL, Logout URL and upload URL from the receiver system, i don't see any place in receiver HTTP adapter to put all these 3 URL's, can i use SOAP adapter to put all these URL anywhere?
    Any help would be appreciated.
    Thanks
    Saif
    Edited by: Saif Manzar on Jan 19, 2010 2:51 AM

    Hey Guys,
    I need to post a Flat file over HTTP (or SOAP), is this possible without developing my own Adapter module?
    I just need to get a Flat file from a FTP server and post to another server via HTTP,since there is no message mapping involved, i developed the scenario without any Integration Repository objects, it is just a pass-through scenario.
    Now i am stuck on the receiver side since i am unable to post Flat file over HTTP.
    Secondly i have Login URL, Logout URL and upload URL from the receiver system, i don't see any place in receiver HTTP adapter to put all these 3 URL's, can i use SOAP adapter to put all these URL anywhere?
    Any help would be appreciated.
    Thanks
    Saif
    Edited by: Saif Manzar on Jan 19, 2010 2:51 AM

  • Retrieve data/files fro HTTP POST request in On-Demand process

    Hello,
    I would like to integrate https://github.com/blueimp/jQuery-File-Upload to my APEX 4.2 application inside XE11g. I would like to use this kind of jQuery component, multiple file upload, use Drag & Drop, image resize, size limit, filter extensions etc...
    This jQuery component and also others javascript uploaders sends data files to some defined URL. Developer need to build some servlet, php script or something on server side that will read files from HTTP request and stores it somewhere.
    Do you know how to do it in APEX? How can I read data from HTTP POST request in PL/SQL? Now I can only call my On-Demand application process from javascript, but I am not able to read any data from HTTP POST in it.
    Can I do it in APEX, or using MOD_PLSQL?
    I would like to implement this:
    1) some javascript uploader will call some URL of my application and sends HTTP POST with data files
    2) I will read data files from HTTP POST and store them into database
    3) I will create some HTTP response for javascript uploader
    Thank you for some tips

    I know about that existing plugin " Item Plugin - Multiple File Upload"
    But I doesn't work in IE and has only basic features. Licence for commercial use is also needed. I would like to use some existing jQuery plugin. There are many of these plugins with nice features. And only one problem is that I need to create some server side process/servlet/script.. that can recieve HTTP request, get files from it and stores them into DB.

  • Downloding big files on 3g/4g

    hello all
    first of all i like to say i mad at nokia for stoping 3g /4g big downloading over 20meg//
    i have a unlited internet plan sim deal
    but my phone stoping me to use
    ok here we go
    i like nokia to make it so we have a opshon for downloading over 3g big files /on/off system
    first    i understand 3g can be slower then wifi some times and unstabul but it belive it up to the user to use it or not/
    2ed   i understand some ppl use download and go over data so i sogest you set it by defrolt seting to the 20meg on but can be removed by seting.s menu
    now i explane y i a making this post today for the opshon for on/off downloading big files over 20meg not ust desable all the time
    today i went in my car and i got lost yes lost i went to use my phone to get me to a fomila place
    but as i was going to use nokia here maps it ask to download my regon map's i tryed just england on it own it was 200meg and it asked for wifi i had no way of geting wifi i was lost and nokia not alow me to try download on 3g even i got unlimited internet plan
    i belive this opeshon shud be up to the user to use or not
    even if it slow bad downloads crash or data limits / its up to the users// your makeing custermers hate nokia/windowsphones
    thanks keep the peace pzz add your coments
    Solved!
    Go to Solution.

    Nokia hasn't told you to go to the Windows webpage, I have suggested you do that. If you want an answer from Nokia you need to contact Nokia directly as this is a public forum.
    Microsoft control the software so it's them that you need to let know that you are unhappy, it really is that simple. I don't know what exactly can be said here to make you feel better?
    Nokia does pass on user feedback to Microsoft but what is the harm done if you also tell Microsoft yourself? Is it really that difficult to copy and paste your comments on to another site?
    There is nothing further that the users of this forum can say or do to help you on this.

  • One  last try... emulating HTTP POST with applet

    I am trying emulate the HTTP POST method for file uploading using an applet. More specifically, I am trying to upload raw data to a PHP script by making the PHP script think it is receiving a file when in reality all it is receiving is a series of headers, some other necessary info, the data, and a closer. The PHP is then supposed to save the data into a file.
    I have looked at eight or ten threads, explanations, and sample code in this and other forums that deal with this exact same thing, some even specific to PHP, read various documents on and explanations of HTTP headers and so forth, corrected every code error and possible code error I could find, and tried a gazillion variations, but still can't get the PHP script to think that it is receiving a file.
    As far as I can tell, communication with the server is being established, the server is receiving info and sending responses back, the PHP script is defrinitely being activated to do its thing, but the PHP is not recognizing anything that looks like a file or even a file name to it.
    The following information may be relevant:
    The PHP works perfectly with real files uploaded from real HTML pages.
    The server uses Apache.
    The server has no Java support (shouldn't matter, but otherwise I would be using servlets at that end instead of PHP).
    the applet is in a signed jar, and is trying to store information in the same directory that it came from.
    I am using the Firefox browser (shouldn't matter?) .
    I am hoping that someone knowegeable about this can look at the code below and point our any errors. I've also included the response I get from the server, and the PHP code. If there are no obvious errors, can you think of anything else tthat might be going wrong besides the code itsef?
    Please don't suggest I try alternate means of doing this or grab some working code from somewhere. I may very well wind up doing that, but I'm a stubborn bastard and want to find out what the #^%R$($ is going wrong here!!!
    Here is the latest incarnation of the applet code: All it does is immediately try to send some text to the PHP script in such a way that the script thinks it is uploading text within a file. it also displays the responses it gets from the server, including what the PHP script sends back.
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    public class test1 extends Applet{
    DataOutputStream osToServer;
    DataInputStream isFromServer;
    HttpURLConnection uc;
    String content = "This is a test upload";
    public void init(){
    try
    URL url = new URL( "http://www.mywebpage.com/handleapplet.php" );
    uc = (HttpURLConnection)url.openConnection();
    uc.setRequestMethod("POST");
    uc.setDoOutput(true);
    uc.setDoInput(true);
    uc.setUseCaches(false);
    uc.setAllowUserInteraction(false);
    uc.setRequestProperty("Connection", "Keep-Alive");
    //uc.setRequestProperty("HTTP_REFERER", "http://applet.getcodebase");
    uc.setRequestProperty("Content-Type","multipart/form-data; boundary=7d1234cf4353");
    uc.setRequestProperty( "Content-length", ( Integer.toString( content.length() ) ) );
    osToServer = new DataOutputStream(uc.getOutputStream());
    isFromServer = new DataInputStream(uc.getInputStream());
    catch(IOException e)
    System.out.println ("Error etc. etc.");
    return;
    try{
    osToServer.writeBytes("------------------------7d1234cf4353\r\nContent-Disposition: form-data; name=\"testfile\"; filename=\"C:testfile.txt\"\r\nContent-Type: text/plain\r\n\r\n");
    osToServer.writeBytes(content);
    osToServer.writeBytes("\r\n------------------------7d1234cf4353--\r\n");
    osToServer.flush();
    osToServer.close();
    catch (Exception e) {
    System.out.println(e);
    System.out.println("did not sucessfully connect or write to server");
    System.exit(0);
    }//end catch
    try{
    String fieldName="",fieldValue="";
    for ( int i=0; i<15; i++ )
    fieldName = uc.getHeaderFieldKey(i);
    System.out.print (" " + fieldName +": ");
    fieldValue = uc.getHeaderField(fieldName);
    System.out.println (fieldValue);
    }catch(Exception e){
    System.out.println ("Didn't get any headers");
         try{        
    String sIn = isFromServer.readLine();
                        for ( int j=0; j<20; j++ )
                             if(sIn!=null)
    System.out.println(sIn);
                             sIn = isFromServer.readLine();
    isFromServer.close();
    }catch(Exception e){
              e.printStackTrace();
    }//end AudioUp.java
    Here's the response I get back from the server:
    null: HTTP/1.1 200 OK
    Date: Sun, 03 Apr 2005 18:40:04 GMT
    Server: Apache
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    null: HTTP/1.1 200 OK
    <html>
    <head>
    <title>Handling uploaded files from an applet, etc.</title>
    </head>
    <body>
    No file was uploaded.
    </body>
    </html>
    The <html> and the "No file uploaded" message is simply what the PHP script sends back when it does not detect any uploaded file.
    Here is the PHP code on the server:
    <html>
    <head>
    <title>Handling uploaded files from an applet, etc.</title>
    </head>
    <body>
    <?php
    if ($testfile)
    print "The temporary name of the test file is: $testfile<br />";
    $uplfile=$testfile_name;
    $uplfile=trim($uplfile);
    print "The filename is: $uplfile<br />";
    if ($uplfile)
    copy ($testfile, "$testfile_name");
    unlink ($testfile);
    }else{
    print "No file was uploaded.";
    ?>
    </body>
    </html>

    xyz's sample code didn't work - PHP doesn't like the getallheaders line at all. I'm going back to the manual now.
    I had another thought. When I first started using PHP, I had problems with ordinary text field uploads from web pages because somewhere in the process, extra blank lines or spurious carriage returns were being inserted into the strings. For example, if I had a place where people could enter their name, password, and brief message, and tried to store the incoming strings in an array, I'd wind up with some thing like:
    name
    password
    brief message
    instead of:
    name
    password
    brief message
    Which played havoc when trying to read out information by counting lines.
    Anyway, the problem was solved by using the trim($string) function on all incoming strings, which I now do as a matter of course. I never could figure out why it was happening though.
    Do you think something like that could be happening here?? I mean, if spurious blank lines or carriage returns were being inserted where they shouldn't be, could that be screwing things up in this way? HTTP seems to insist on having new lines and blank lines inserted in just the right places.

  • Uploading big files via http post to XDB table

    Hello,
    I ve created a web form for to upload files as blobs to the database using XML DB, DBPS_EPG package and preconfigured DAD.
    The issue is that small files (~10kb) are being uploaded ok, but file which is 100K during http post returns connection reset from the server side.
    To my opinion there might be some max file size parameter for oracle server to accept during oracle listener tcp connection (as apach has maxrequestlimit).
    Is there any workaround for to load large files to the XDB table via webform?
    Here is a piece of code:
    CREATE USER web IDENTIFIED BY web_upload;
    ALTER USER web DEFAULT TABLESPACE XML_DATA;
    ALTER USER web QUOTA UNLIMITED ON XML_DATA;
    ALTER USER web TEMPORARY TABLESPACE TEMP;
    GRANT CONNECT, ALTER SESSION TO web;
    GRANT CREATE TABLE, CREATE PROCEDURE TO web;
    ALTER SESSION SET CURRENT_SCHEMA = XDB;
    BEGIN DBMS_EPG.CREATE_DAD('WEB', '/upload/*'); END;
    BEGIN
        DBMS_EPG.SET_DAD_ATTRIBUTE('WEB', 'database-username', 'WEB');
        DBMS_EPG.SET_DAD_ATTRIBUTE('WEB', 'document-table-name', 'uploads');
        DBMS_EPG.SET_DAD_ATTRIBUTE('WEB', 'nls-language', '.al32utf8');
        DBMS_EPG.SET_DAD_ATTRIBUTE('WEB', 'default-page', 'upload');
        COMMIT;
    END; 
    ALTER SESSION SET CURRENT_SCHEMA = SYS;
    CREATE TABLE web.uploads (
        name VARCHAR2(256) NOT NULL
            CONSTRAINT pk_uploads PRIMARY KEY,
        mime_type VARCHAR2(128),
        doc_size NUMBER,
        dad_charset VARCHAR2(128),
        last_updated DATE,
        content_type VARCHAR2(128) DEFAULT 'BLOB',
        blob_content BLOB
    CREATE OR REPLACE PROCEDURE web.upload
    AS
      url VARCHAR2(256) := 'http://demo.test.com:9090/upload/uploaded';
    BEGIN
        HTP.P('<html>');
        HTP.P('<head>');
        HTP.P('  <title>Upload</title>');
        HTP.P('</head>');
        HTP.P('<body>');
        HTP.P('  <h1>Upload</h1>');
        HTP.P('  <form method="post"');
        HTP.P('      action="' || url || '"');
        HTP.P('      enctype="multipart/form-data">');
        HTP.P('    <p><input type="file" name="binaryfile" /></p>');
        HTP.P('    <p><input type="file" name="binaryfile" /></p>');
        HTP.P('    <p><button type="submit">Upload</button></p>');
        HTP.P('  </form>');
        HTP.P('</body>');
        HTP.P('</html>');
    END;
    CREATE OR REPLACE PROCEDURE web.uploaded (
        binaryfile OWA.VC_ARR
    AS
    BEGIN
        HTP.P('<html>');
        HTP.P('<head>');
        HTP.P('  <title>Uploaded</title>');
        HTP.P('</head>');
        HTP.P('<body>');
        HTP.P('  <h1>Uploaded</h1>');
        FOR i IN 1 .. binaryfile.COUNT LOOP
            IF binaryfile(i) IS NOT NULL THEN
                HTP.P('  <p>File: ' || binaryfile(i) || '</p>');
            END IF;
        END LOOP;
        HTP.P('</body>');
        HTP.P('</html>');
    END;
    /帖子经 anatoly编辑过

    Welcome to Apple Discussions!
    Much of what is available on Bittorrent is not legal, beta, or improperly labelled versions. If you want public domain software, see my FAQ*:
    http://www.macmaps.com/macosxnative.html#NATIVE
    for search engines of legitimate public domain sites.
    http://www.rbrowser.com/ has a light mode that supports binary without SSH security.
    http://rsug.itd.umich.edu/software/fugu/ has ssh secure FTP.
    Both I find are quick and a lot more reliable than Fetch. I know Fetch used to be the staple FTP program, but it grew too big for my use.
    - * Links to my pages may give me compensation.

  • I was loading a big file of photos from iPhoto to Adobe Photoshop CS3 and it keep collapsing, yet each time I reopen photoshop it load the photos again and cal laps again. is there a way to stop this cycle?

    I was loading a big file of photos from iPhoto to Adobe Photoshop CS3 and more then midway it keep collapsing, yet each time I re-open photoshop to load a small amount of photos, it load the previous photos again, and again it collapse. is there a way to stop this cycle and start a new?

    http://helpx.adobe.com/photoshop.html

  • Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout).

    Hi, I am using HP11 and iPlanet web server. When trying to upload files over HTTP using FORM ENCTYPE="multipart/form-data" that are bigger than a few Kilobytes i get a 408 error. (client timeout). It is as if the server has decided that the client has timed out during the file upload. The default setting is 30 seconds for AcceptTimeout in the magnus.conf file. This should be ample to get the file across, even increasing this to 2 minutes just produces the same error after 2 minutes. Any help appreciated. Apologies if this is not the correct forum for this, I couldn't see one for iPlanet and Web, many thanks, Kieran.

    Hi,
    You didnt mention which version of IWS. follow these steps.
    (1)Goto Web Server Administration Server, select the server you want to manage.
    (2)Select Preference >> Perfomance Tuning.
    (3)set HTTP Persistent Connection Timeout to your choice (eg 180 sec for three minutes)
    (4) Apply changes and restart the server.
    *Setting the timeout to a lower value, however, may    prevent the transfer of large files as timeout does not refer to the time that the connection has been idle. For example, if you are using a 2400 baud modem, and the request timeout is set to 180 seconds, then the maximum file size that can be transferred before   the connection is closed is 432000 bits (2400 multiplied by 180)
    Regards
    T.Raghulan
    [email protected]

  • Retreiving files over http or ftp.

    I was wondering what program I should use to retreive files over http or ftp. Previously I had used wget per my hosting provider's recommendation. It worked when I was ssh logged in to his server (via Mac Terminal). However, when I try using wget on my local Mac it says "command not found".

    Thanks. So if I specify a file name (-o /path/to/file), does the incoming file get renamed to that (and put in that location) or does this specify the directory (-o /path/to/directory) that the incoming file will go to? I wasn't quite clear on that.
    Also, I keep hearing about stdout. What is it exactly? I assumed it was just the Terminal window itself, the alternative being things like | more or | nano or something like that... Or am I totally up the wrong tree?

  • Is it possible for ODi to do a "https post" of an xml file?

    Hi,
    We would like to use ODI to read from a VIEW and within ODI transform to a target using an XSD to generate an XML file and then do a HTTPS POST. Would be grateful for any pointers.
    we also ran into issues while transforming using a target xsd. Listed below:
    Use Case Context: In an ODI interface, Data from a database view is mapped to a target XSD schema. A package is then created, wherein, in the first step, this interface is executed. Then, in the second and final step, data transferred to the target XSD schema is saved as an XML file using OdiSqlUnload function.
    Problems faced in the above mentioned use case:
    When the data from the target XSD schema is saved as an XML file using OdiSqlUnload function, the XML does not match the XSD, which was initially imported into ODI.
    Regards
    Shema

    Ask them!  Product Feedback
    This is a user to user forum.  We are all end users like yourself.  Know one here knows what Apple is going to do.

  • File upload using http-post in OSB

    Hi All,
    I am trying to upload a file using http-post method in OSB.
    I have created a business service pointing to the service url, with http method post.
    and calling this business service from a proxy service.
    I am unable to send the form data to the business service.
    Please let me know how to send trhe form data and the file information.
    The error given by Business Service is-
    the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is text/plain
    Thanks in advance.
    Seemant
    Edited by: Seemant Srivastava on Oct 12, 2010 12:28 PM

    Hi Anuj,
    A sample HTML form code for. Post HTTP service-
    <html>
    <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CSV File</title>
    </head>
    <body>
    <form method="post" enctype="multipart/form-data" action="http://xyz/UploadFile">
    <table>
    <tr>
    <td> Feed id </td>
    <td><input type="text" name="refid" value="" size="20"></td>
    </tr>
    <tr>
    <td> Username (optional)</td>
    <td><input type="text" name="username" value="" size="20"></td>
    </tr>
    <tr>
    <td> Password (optional)</td>
    <td><input type="password" name="password" value="" size="20"></td>
    </tr>
    <tr><td> Select CSV File </td>
    <td> <input type="file" name="upload" value="" width="30"/></td>
    </tr>
    <tr>
    <td><input type="submit" name="Ok" value="Go"> <input type="reset" name="reset" value="Reset"> </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    I need to pass all these information to OSB business service.

  • Specify file name of the document returned on the HTTP post

    Hello,
    we are submitting a PDF form by calling submitForm function:
    doc.submitForm
            cURL: "http://localhost/script",
            cSubmitAs: "XML"
    The server returnes data of type "Content-type: application/pdf" and as a result this aplication/pdf data is displayed in a new window in Acrobat Reader.
    The document in new window has name e.g. A9R3347.tmp, is it possible to force some concrete name ?
    We tried to send from server the http header:
    Content-Disposition: attachment; filename=\"custom_name.pdf\"
    or   
    Content-Type: application/pdf;         filename=custom_name.pdf
    but non of this works.
    1/ is it possible to set some custom name of the document, which is returned from a server in response of HTTP Post submit ?
    2/ is it possible to return other kind of data then application/pdf ? ( my tests with AR 9.3 with other formats failed).
    Thanks for any advice.

    See Oracle Metalink,
    ..Oracle Portal Technical Forum,
    ....Subject: PORTAL - uploading files (file attachments) with file names.
    This message thread outlines javascript code that automatically captures the filename during an upload.

Maybe you are looking for

  • Random disconnection from internet

    My Macbook keeps loosing its internet connection. It's not a problem with my internet provider. I have to continually turn the AirPort on and off to re-establish connection. Any suggestions?

  • Broken screen, erased main disk, cannot boot to Recovery Mode to reinstall OS X

    I am using a MacBook Air from around 2010, not really sure what version of the OS was on it prior to erasing. The screen is broken so I have to either duplicate the screen or use clamshell mode to see anything. When booting in Recovery Mode by holdin

  • Printing multiple sets of Portfolio documents collated

    I use Adobe Acrobat 9 Pro's pdf Portfolio to print multiple documents with similar printing properties (two-sided, stapled, hole-punched) but they are separately two-sided and separately stapled. I try doing multiple copies but the print job comes ou

  • Workflow in Dispute Management

    Hi, Is there anything additionally required to get the standard workflow in FSCM Dispute Management going? I have activated / completed the task specific customising but nothing is happening. Also, where is the option to send WF messages as express?

  • Open an input schedule from a link

    Ok, so without saving everything under eAnalyse > report Library > Wizard, and using evHOT.   how do I open an input schedule located in eSubmit > Open Schedule Library.  I can save them in the wizards folder there if needed.  But seems like it shoul