File Upload

HELP!!! I am stuck … I have been searching wmusers, advantage etc … and I keep finding parts of the answer but not the whole answer… Any help would be welcomed … I am using wm IS 6.5

I have this niffty web page that allows me to select multiple files, and it then calls a webMethods service which I can extract (get) the ContentStream and then convert it into mimeData document.

I can use the wm Public mime services to getBodyPart and getBodyPartHeader.

Then this is where I start hitting me head against a brick wall, for the past 3 days. How do I parse out the filenames, and the actual file content to then save them to some location on my wm unix server.

My guess is I need some sort of java service that is able to parse out the body/part/content (((java.io.ByteArrayInputStream@13fee37)))) into the right pieces and then i can use them however … I am not a java guy (I can barely spell java)

Here is example of the output I am receiving and then the html for the web page I am using for data entry

*** The web page is really cool how it works ***

 *************************************************
*************************************************
inString     -----------------------------145551812432175 Content-Disposition: form-data; name="thisApp" jsa -----------------------------145551812432175 Content-Disposition: form-data; name="thisSource" -----------------------------145551812432175 Content-Disposition: form-data; name="file_1"; filename="" Content-Type: application/octet-stream -----------------------------145551812432175 Content-Disposition: form-data; name="file_0"; filename="test5.txt" Content-Type: text/plain file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information -----------------------------145551812432175--
beginIndex     2
endIndex     48
subString     C
fromIndex     0
stream     java.io.ByteArrayInputStream@14279a3
mimeData     
headers     
-----------------------------145551812432175     -----------------------------145551812432175
Content-Disposition     form-data; name="doThis"
content-transfer-encoding     7bit
content-type     text/plain
part     
smime     false
headers     
Content-Disposition     form-data; name="doThis"
content-transfer-encoding     7bit
content     java.io.ByteArrayInputStream@13fee37
startVal     2
content     java.io.ByteArrayInputStream@14279a3
string     -----------------------------145551812432175 Content-Disposition: form-data; name="thisApp" jsa -----------------------------145551812432175 Content-Disposition: form-data; name="thisSource" -----------------------------145551812432175 Content-Disposition: form-data; name="file_1"; filename="" Content-Type: application/octet-stream -----------------------------145551812432175 Content-Disposition: form-data; name="file_0"; filename="test5.txt" Content-Type: text/plain file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information file5-ID file5-description file5-Somesort of information -----------------------------145551812432175--
endVal     48
mimeHeader     
Content-Disposition     form-data; name="doThis"
content-transfer-encoding     7bit
magicKey     -----------------------------145551812432175
primContentType     text
subContentType     plain
value     -----------------------------145551812432175
valueList     
-----------------------------145551812432175
Content-Disposition:
form-data;
name="thisApp"
jsa
-----------------------------145551812432175
Content-Disposition:
form-data;
name="thisSource"
-----------------------------145551812432175
Content-Disposition:
form-data;
name="file_1";
filename=""
Content-Type:
application/octet-stream
-----------------------------145551812432175
Content-Disposition:
form-data;
name="file_0";
filename="test5.txt"
Content-Type:
text/plain
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
file5-ID
file5-description
file5-Somesort
of
information
-----------------------------145551812432175--
*************************************************

data entry web page


<head>

<script language="JavaScript1.2">

// ======================================
function doMoveIt(mAction,aAction) {
// ======================================
   top.document.fileMoverAction.doThis.value = mAction;
   if (aAction){top.document.fileMoverAction.adminAction.value = aAction;};
   top.document.fileMoverAction.submit();
} // end function doMoveIt() 

// =========================================
function MultiSelector( list_target, max )
// =========================================
{
this.list_target = list_target;
this.count = 0;this.id = 0;
if( max ){  this.max = max;} else {this.max = -1;};

this.addElement = function( element ){
if( element.tagName == 'INPUT' && element.type == 'file' ){
  element.name = 'file_' + this.id++;element.multi_selector = this;
  element.onchange = function(){var new_element = document.createElement( 'input' );
new_element.type = 'file';this.parentNode.insertBefore( new_element, this );
this.multi_selector.addElement( new_element );
this.multi_selector.addListRow( this );
this.style.position = 'absolute';
this.style.left = '-1000px';};

if( this.max != -1 && this.count >= this.max ){
  element.disabled = true;};this.count++;this.current_element = element;}
 else {alert( 'Error: not a file input element' );};};

this.addListRow = function( element )
{var new_row = document.createElement( 'div' );
var new_row_button = document.createElement( 'input' );
new_row_button.type = 'button';
new_row_button.value = 'Delete';
new_row.element = element;
new_row_button.onclick= function()
{this.parentNode.element.parentNode.removeChild( this.parentNode.element );
this.parentNode.parentNode.removeChild( this.parentNode );
this.parentNode.element.multi_selector.count--;
this.parentNode.element.multi_selector.current_element.disabled = false;
return false;
};
new_row.innerHTML = element.value;
new_row.appendChild( new_row_button );
this.list_target.appendChild( new_row );};
};
// end function  MultiSelector() 

</script>
</head>

<body>
<form name="fileMoverAction" enctype="multipart/form-data" method="post" action="http://myserver:6777/invoke/myservice:HERE" >
<input type="hidden" name="doThis" value="">

<!-- The file element -- NOTE: it has an ID -->

<input id="my_file_element" type="file" name="file_1"  >
    <br><br>
    <b>Files to Send:</b><br>

    <!-- This is where the output will appear -->
    <div id="files_list">
    <script>
      <!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
      var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 10 );
      <!-- Pass in the file element -->
      multi_selector.addElement( document.getElementById( 'my_file_element' ) );
    </script>
</div>
<INPUT type="submit" value="Upload File">    
</form>

</body>

**********************************
END OF WEB PAGE

ANY HELP WOULD BE WELCOME!!!

Thanks paul
myuploadpage.txt (2.83 KB)

Did you see this page I put up on binary file upload here:? [url]wmusers.com

If you follow the steps there, it should be simple. This process does not use the WmPublic MIME services at all - just install the WM-provided ContentHandler.zip package, and let webMethods do the hard work converting the uploaded files to byte arrays.

I suggest you try uploading one file first, then modify that to upload multiple files.