Uploading Binary File

Hi,
I have all the server side stuff working and it receives ordinary file uploads from a form just fine.
However, I now need to use a Java Applet instead of this HTML form and it all goes just fine except the binary file that appears on the server is missing it's 2K header.
This is a very serious problem for me, as I have got to complete this ASAP.
I have been trying to make this work now for 3 days and I cannot find a solution anywhere on the Internet.
any thoughts?
cheers
Bruce

My code currently is as follows, sorry all the indenting seems to have vanished after pasting the code in:-
import com.ms.security.*;
import java.lang.*;
import java.net.*;
import java.io.*;
import java.util.*;
import java.applet.*;
public class urlFetch extends Applet {
public void UploadFile(String serverURL,
String serverFilePath,
String clientFilePath,
String filename,
// Form values
String func,
String objType,
String objAction,
String parentId,
String CTT_ID,
String nextURL,
String comment,
String InheritRequired,
String CREATE_Required,
String CREATE_Edited,
String CREATE_CacheID,
String CREATE_CatNames,
String name) {
try {
          System.out.println("***Get Permission");
          PolicyEngine.assertPermission(PermissionID.FILEIO);
          System.out.println("***Create URL : " + serverURL);
          URL url = new URL(serverURL);
          System.out.println("***Create Connection");
          URLConnection conn = url.openConnection();
          String str = "";
          System.out.println("***Create data");
          str += "--" + BOUNDARY + NEWLINE;
          // Add all the values of the form data fields.
          str += _formData("func",            func);
          str += _formData("objType",         objType);
          str += _formData("objAction",       objAction);
          str += _formData("parentId",        parentId);
          str += formData("CTTID", CTT_ID);
          str += _formData("nextURL", nextURL);
          str += _formData("comment", comment);
          str += _formData("InheritRequired", InheritRequired);
          str += _formData("CREATE_Required", CREATE_Required);
          str += _formData("CREATE_Edited", CREATE_Edited);
          str += _formData("CREATE_CacheID", CREATE_CacheID);
          str += _formData("CREATE_CatNames", CREATE_CatNames);
          str += _formData("name", name);
          byte[] formData = str.getBytes();
          str = "";
// add the file
          str += "Content-disposition: form-data; name=\"versionFile\"; filename=\"" + filename + "\"";
          str += "Content-type: application/msword" + NEWLINE;
          str += "Content-Transfer-Encoding: binary" + NEWLINE;
          byte[] fileHeader = str.getBytes();
          byte[] fileContents = _readFile(clientFilePath);
          str = "";
          str += NEWLINE; //This is the file content
          str += "--" + BOUNDARY + "--" + NEWLINE;
          byte[] fileFooter = str.getBytes();
          System.out.println("***Setup Request***");
          conn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
          int lengthOfData = formData.length + fileHeader.length + fileContents.length + fileFooter.length;
          System.out.println("***Data Length : " + lengthOfData);
          System.out.println("***File Length : " + fileContents.length);
          conn.setRequestProperty("Content-Length", String.valueOf(lengthOfData) );
          conn.setDoOutput(true);
          conn.setUseCaches(false);
          System.out.println("***Get Output Stream");
          DataOutputStream os = new DataOutputStream(conn.getOutputStream());
          System.out.println("***Connect");
          conn.connect();
          System.out.println("***Send data");
          os.write( formData, 0, formData.length );
          os.write( fileHeader, 0, fileHeader.length );
          os.write( fileContents, 0, fileContents.length );
          os.write( fileFooter, 0, fileFooter.length );
          System.out.println("***Flush");
          os.flush();
          System.out.println("***Close");
          os.close();
catch ( Exception e ) {
System.out.println("***** Exception: " + e.toString());
* Split a String on delimiters to return an array of the delimited Strings.
* @param s The String to split up
* @param d The delimiter on which to split s
* @return Array of delimited Strings from s.
private String[] _split(String s, String d) {
StringTokenizer st = new StringTokenizer(s,d);
String[] parts = new String[st.countTokens()];
int i = 0; // Loop counter
while (st.hasMoreTokens())
parts[i++] = st.nextToken();
return parts;
* Create a String which is the HTTP representation of the field name/value pair
* @param fieldName The HTML field name
* @param fieldVal The (String) field value
* @return A String to be used in the HTTP sent to the server.
private String _formData(String fieldName, String fieldVal) {
// return fieldName + " = " + fieldVal + NEWLINE;
return "Content-Disposition: form-data; name=\"" + fieldName + "\"" + NEWLINE + NEWLINE
+ fieldVal + NEWLINE
+ "--" + BOUNDARY + NEWLINE;
* Read the contents of filePath as a String and return.
* @param filePath The full path to the file to be read
* @return A string containing the contents of the file
private byte[] _readFile(String filePath) {
     byte[] bytes;
     try {
          File fileIn = new File(filePath);
          FileInputStream fis = new FileInputStream(fileIn);
          bytes = new byte[ (int)fileIn.length() ];
          fis.read(bytes);
/* my old one
          FileReader fr = new FileReader(filePath);
          int charsRead = 0;
          //my new bits
          File fileIn = new File(filePath);
          FileInputStream fis = new FileInputStream(fileIn);
          int size = ((int) fileIn.length());
          bytes = new byte[size];
          byte[] aByte = new byte[1];
          int n = 0;
          for (int i = 0; size > i; i++ ) {
               charsRead = fis.read(aByte);
               bytes[n] = aByte[0];
     ++n;
/*          mick's original ***
          StringBuffer sBuffer = new StringBuffer();
          while (charsRead != -1) {
          charsRead = fr.read(BUFFER, 0, BUFFER_LEN);
          if( charsRead != -1 ) {
               sBuffer.append(BUFFER, 0, charsRead);
catch ( Exception e ) {
          bytes = new byte[1];
System.out.println("***** Exception xxx: " + e.toString());
// return sBuffer.toString();
     return bytes;
* Private statics
private static final String BOUNDARY = "BbC04y";
private static final int BUFFER_LEN = 4096;
private static byte[] BUFFER = new byte[BUFFER_LEN];
private static final String NEWLINE     = "\r\n";

Similar Messages

  • How to upload binary file in database?

    Using servlets..how to upload binary file into database...
    How to get the data of file in servlet...
    Please reply...i'm unable to find exact code...that i want..

    You need to do two separate parts: accept the file from a HTTP multi-part POST and then stream it into a BLOB on the database. To do the former, download Jakarta Commons FileUpload. There is extensive documentation on how to write a simple handler for the upload. You then need to send the data to a BLOB. The specifics vary from database to database but generally you will insert or update a row with an empty blob, get a reference to the blob, pipe the data and then commit.
    If you do a quick forum search, this question has been asked (and answered) dozens of times. Some of the replies may even have code for you. Best of luck.
    - Saish

  • Upload binary files with Developer Forms

    Hi all,
    I'm newbie with Forms and I don't know if this question is already answered.
    I'm deploying an application involved with blob columns (binary files: pdf, doc, gif, etc) I want to let users to choose files from his PCs (typical "Browse files" button) but I don´t know if this is possible and if yes, how to implement it.
    Anybody can help me?
    My email is [email protected]
    Thanks in advance!
    Cristina

    If you want to upload direct into the database from the client then No you will need a 9i database or above.
    If you want to upload a file from the browser client to the middle tier (Application server) then that will be OK no matter what DB version you are using. Bug of course you'll then need to do the last bit yourself if you want the document / image put into the database.

  • Gui_upload for uploading binary file

    Hello All,
    I am trying to upload '.jpg' files using gui_upload function.
    But something goes wrong and it dumps.
    I am new to ABAP.
    following is the code i used.
      DATA: xline TYPE xstring.
      DATA : t_file LIKE TABLE OF xline WITH HEADER LINE.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filetype = 'BIN'
          filename = 'C:\Documents and Settings\I046674\Desktop\RawTest\images\Image_1000.jpg'
        TABLES
          data_tab = t_file.
    It dumps in the 'GUI_UPLOAD' function itself.
    Saying follownig,
    ==========================================
    Error analysis
        The error occurred at a statement in the form
          ASSIGN f TO <fs> TYPE t
        One of these two cases occurred:
        1) Field f is a string, a data reference, an object reference, an
           internal table or a structure that contains such a field. With the
           TYPE addition, this is not possible.
        2) Field f is of type x and field symbol <fs> has a character-type type.
           When executing the statement, the length of f is not a multiple of
           the length (in bytes) of a Unicode character.
    ===============================================
    Can someone help me on this?
    Thanks & Regards,
    Abhijit

    hi,
    Master Data Documents Upload ABAP Program
    Re: Upload Master Data documents
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = 'c:\temp\text.txt'
    filetype = ' '
    IMPORTING
    filelength = fleng
    TABLES
    data_tab = text_tab
    EXCEPTIONS
    file_write_error = 1
    invalid_type = 2
    no_authority = 3
    unknown_error = 4
    OTHERS = 10.
    thanks

  • Upload binary file with DSEEntry

    Hi ,
    I have created a Class for a upload pictures to the IDM Database .
    Now I have the problem with the upload.... and the mssql datatype.
    At the moment the type is binary(max)
    is there any option to add a byte[] to DSEntry.put ?
    It seems that DSEntry always try a cast to string , and when put a byte[] I receive an exception.
    Regards

    Usually binary values are B64 or HEX encoded during processing in IdM. I take it you're trying to write it to a column of datatype binary, not an actual IdM attribute. Perhaps you should use varbinary(max) if you want to exceed 8000 bytes. But, the internal datatypes and the JDBC datatypes are not the same, so for SQL Server you need to use LONGVARBINARY.
    see this MicroSoft reference: Using Advanced Data Types
    Anyway, here's a working example. The $includebin function is documented in the helpfile but its usage is pretty self explaining in my example here:
    My table looks like this:

  • Struts commons binary file upload issue

    Hi,
    I was wondering if someone could help me with uploading binary files using jakarta commons file upload. I've looked at several examples and forums and it seems to work but sometimes the binary files that I upload get corrupted. I have no idea why this might be happening. Here is a snippet of my code.
        UploadFileForm uploadFileForm = (UploadFileForm)form;
        FormFile file = uploadFileForm.getFile();
        String dirName = "/tmp/";
        InputStream inputStream = null;
        OutputStream bos = null;
        inputStream = file.getInputStream();
        bos = new FileOutputStream(dirName + file.getFileName());
        int bytesRead = 0;
        byte[] buffer = new byte[4096];
        while ((bytesRead = inputStream.read(buffer, 0, 4096)) != -1) {
            bos.write(buffer, 0, bytesRead);
        }            Am I doing something wrong?
    Thanks.
    PV

    FormFile myFile    = myForm.getTheFile();
        byte[] fileData    = myFile.getFileData();
        BufferedReader in = null;
       try{
           in = new BufferedReader(new InputStreamReader(new   ByteArrayInputStream(fileData)));
           // in = new BufferedReader(new  InputStreamReader(myFile.getInputStream()));
           String str;
            while ((str = in.readLine()) != null) {
                    System.out.println(str);
       }catch(Exception exp){
           exp.printStackTrace();
        }finally{
             if(in != null){
                try{
                   in.close();
                }catch(Exception ep){
                       ep.printStackTrace();
        } Hope this might help :)
    and a small advice please do reactivate archived posts.It'd be lot better if you start with a new one.
    Hope there are no hard and fast issues on this.
    REGARDS,
    RaHuL

  • WLS 5.1 w/sp8 garbeling binary files when uploaded.

    I have implemented multiple methods of handling file uploads in servlets.
              I have tried the Marsh:
              http://sourceforge.net/projects/marsh/
              and the Oreilly com.oreilly.servlet:
              http://www.servlets.com/cos/index.html
              helper libraries as well as my own code, yet I still have the same problems.
              For some reason some bytes in binary files are being converted to ascii '?'s
              instead of the proper bytes. All uploaded files from all three
              implementations contain the same error, yet no bugs are listed in any of
              them (even Weblogic.)
              I am running WLS 5.1 SP8 on Windows and Linux and am having the same errors
              on both. If you might be thinking it's the way I'm writing the file then
              here is how I am outputing (once I get an input stream from the
              HttpServletRequest).
              /* Code snippet */
              x = myinput_stream.read();
              while(x >= 0) {
              myfile_writer.write(x);
              x = myinput_stream.read();
              myfile_writer.close();
              /* End code snippet */
              If you know how to fix this or you have gotten WLS to upload binary files at
              all then please reply and let me know.
              

    I'll try that and then let you know....
              "Dimitri Rakitine" <[email protected]> wrote in message
              news:[email protected]...
              > Writer's are for character streams - it will work if you use OutputStream
              > to write to a binary file.
              >
              > Hoopy Hacker <[email protected]> wrote:
              > > I have implemented multiple methods of handling file uploads in
              servlets.
              >
              > > I have tried the Marsh:
              >
              > > http://sourceforge.net/projects/marsh/
              >
              > > and the Oreilly com.oreilly.servlet:
              >
              > > http://www.servlets.com/cos/index.html
              >
              > > helper libraries as well as my own code, yet I still have the same
              problems.
              > > For some reason some bytes in binary files are being converted to ascii
              '?'s
              > > instead of the proper bytes. All uploaded files from all three
              > > implementations contain the same error, yet no bugs are listed in any of
              > > them (even Weblogic.)
              >
              > > I am running WLS 5.1 SP8 on Windows and Linux and am having the same
              errors
              > > on both. If you might be thinking it's the way I'm writing the file
              then
              > > here is how I am outputing (once I get an input stream from the
              > > HttpServletRequest).
              >
              > > /* Code snippet */
              > > x = myinput_stream.read();
              > > while(x >= 0) {
              > > myfile_writer.write(x);
              > > x = myinput_stream.read();
              > > }
              > > myfile_writer.close();
              > > /* End code snippet */
              >
              > > If you know how to fix this or you have gotten WLS to upload binary
              files at
              > > all then please reply and let me know.
              >
              > --
              > Dimitri
              

  • Upload Excel File to SharePoint using VBA

    Hi,
    I copied and modified the code from a friend which he got it from this website forum.
    This apprantely works for some people and not me. Please tell me what I am doing wrong.
    Ignore xxxxxx part of the Sharepoint site. Nothing wrong with the site, i tried many combinations, but I get not response, not even an error.
    Public Const HR_URL = "http://sun.xxxxxx.com/eng/st/Lists/Database%20Change% 20Request"
    Sub test()
    'Upload new Excel sheet to SharePoint
    Call copyToSharePoint(HR_URL, ThisWorkbook.FullName)
    End Sub
    '''''''code block from Forum
    Public Sub copyToSharePoint(sharepointURL As String, filePath As String)
    'On Error GoTo errhandler
    'sharePointUrl should not end in a "/"
    'Initialize Variables
    Dim LlFileLength As Long
    Dim Lvarbin() As Byte
    Dim LobjXML As Object
    Dim LvarBinData As Variant
    Dim LstrFileName As String, PstrFullfileName As String, PstrTargetURL As String
    Dim fileName As String, lenFileName As Long
    'Extract file name
    lenFileName = Len(filePath) - InStrRev(filePath, "\")
    fileName = Right(filePath, lenFileName)
    'Check that the webUrl ends in an "/"
    If Right(sharepointURL, 1) <> "/" Then
    sharepointURL = sharepointURL & "/"
    End If
    '**************************** Upload binary files *****************
    Set LobjXML = CreateObject("Microsoft.XMLHTTP")
    PstrFullfileName = filePath
    LlFileLength = FileLen(PstrFullfileName) - 1
    ' Read the file into a byte array.
    ReDim Lvarbin(LlFileLength)
    Open PstrFullfileName For Binary As #1
    Get #1, , Lvarbin
    Close #1
    ' Convert to variant to PUT.
    LvarBinData = Lvarbin
    PstrTargetURL = sharepointURL & fileName
    ' Put the data to the server; false means synchronous.
    LobjXML.Open "PUT", PstrTargetURL, False
    ' Send the file in.
    LobjXML.Send LvarBinData
    Set LobjXML = Nothing
    Exit Sub
    errhandler:
    If Err.Number = 53 Then
    MsgBox "Excel was unable to create the HR file to submit to SharePoint. " & vbNewLine & _
    "Please check that you are not running out of disk space and that no MS Office add-in is causing issues with Excel.", vbCritical, "File Error"
    Exit Sub
    Else
    MsgBox "Your HR could not be submitted to SharePoint. The following error occurred:" & vbNewLine & _
    "Error " & Err.Number & ": " & Err.Description, vbCritical, "Error Uploading to SharePoint"
    Exit Sub
    End If
    End Sub

    I have made the following code work successfully on a Windows 8 machine with the VBA executing from an Excel 2010 file and the file you want to upload going to a SharePoint 2010 site. If you don't need to use SP content types then simply
    take that out of the code. Also, pay attention to the FieldInformation as the Field Display names and Field Internal names can sometimes be different. Cheers.
    Public Sub copyDocToSP()
    Const strLocalFile = "C:\temp\myLocalFile.pdf"
    Const spBASE_URL = "https://thesharepointdomian/sites/yoursite/"
    Const spDOC_LIB = "Your SP Doc Library Name"
    Const spFILE_NAME = "FileNameOnceOnSharepoint.pdf"
    Const spCONTENT_TYPE = "0x000000000000000000000000000000000000000"
    Set ObjectStream = CreateObject("ADODB.Stream")
    Set ObjectDOM = CreateObject("Microsoft.XMLDOM")
    Set ObjectElement = ObjectDOM.createElement("TMP")
    Set ObjectHTTP = CreateObject("Microsoft.XMLHTTP")
    'Reading binary file
    ObjectStream.Open
    ObjectStream.Type = 1 'Type Binary
    ObjectStream.LoadFromFile (strLocalFile)
    BinaryFile = ObjectStream.Read()
    ObjectStream.Close
    'Conversion Base64
    ObjectElement.DataType = "bin.base64" 'Type Base64
    ObjectElement.nodeTypedValue = BinaryFile
    EncodedFile = ObjectElement.Text
    'Build request to load document
    strURLService = spBASE_URL + "_vti_bin/copy.asmx"
    strSOAPAction = "http://schemas.microsoft.com/sharepoint/soap/CopyIntoItems"
    strSOAPCommand = "<?xml version='1.0' encoding='utf-8'?>" & _
    "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" & _
    "<soap:Body>" & _
    "<CopyIntoItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" & _
    "<SourceUrl>" + strLocalFile + "</SourceUrl>" & _
    "<DestinationUrls>" & _
    "<string>" + spBASE_URL + spDOC_LIB + "/" + spFILE_NAME + "</string>" & _
    "</DestinationUrls>" & _
    "<Fields>" & _
    "<FieldInformation Type='Text' InternalName='Title' DisplayName='Title' Value='this is the title value' />" & _
    "<FieldInformation Type='Choice' InternalName='Our_x0020_Status' DisplayName='Our Document Status' Value='Ready-to-distribute' />" & _
    "<FieldInformation Type='Text' InternalName='ContentTypeId' DisplayName='Content Type ID' Value='" + spCONTENT_TYPE + "' />" & _
    "</Fields>" & _
    "<Stream>" + EncodedFile + "</Stream>" & _
    "</CopyIntoItems>" & _
    "</soap:Body>" & _
    "</soap:Envelope>"
    ObjectHTTP.Open "Get", strURLService, False
    ObjectHTTP.SetRequestHeader "Content-Type", "text/xml; charset=utf-8"
    ObjectHTTP.SetRequestHeader "SOAPAction", strSOAPAction
    ObjectHTTP.Send strSOAPCommand
    MsgBox (ObjectHTTP.responseText)
    End Sub

  • How to batch upload PDF files into database BLOB

    Hello.
    I have a requirement to batch upload PDF files into BLOB column of an Oracle 8.1.7 table from Forms 6i Web. The content of the blob column (ie. the PDF content) MUST be displayable from all client software (eg. Oracle Web forms, HTML forms, etc.)
    Our environment is
    Middle-tier is 9iAS on Windows/2000
    Database is Oracle 8.1.7.0.0 on VMS
    Oracle Web Forms 6i Patch 10
    Basically my Oracle web form program will display a list of PDF files to upload and then the user can click on the &lt;Upload&gt; button to do the batch upload. I have experimented the following approaches but with no luck.
    1. READ_IMAGE_FILE forms built-in = does NOT work because it cannot read PDF file. I got error FRM-47100: Cannot read image file
    2. OCX and OLE form item = cannot use this because it does NOT work on the Web. I got error FRM-41344 OLE object not defined
    3. I cannot use DBMS_LOB to do the load because the PDF files are not in the database machine.
    4. Metalink Note 1682771.1 (How to upload binary documents back to database blob column from forms). When I used this, I got ORA-6502 during the hextoraw conversion. In using this solution, I have downloaded a bin2hex.exe from the Google site. I've noticed that when I looked at the converted HEX file, each line has the character : (colon) at the beginning of each line. I know the PDF file has been converted correctly to HEX format because when I convert the HEX file back to BIN format using hex2bin.exe, I'm able to display the converted bin file in Acrobat Reader. When I removed the : (colon) in the HEX file, I did NOT get the ORA-6502 error but I CANNOT display the file in Acrobat Reader. It gives an error "corrupted file".
    5. upload facility in PL/SQL Web toolkit - I tried to automatically submit the html form (with htp.p) but it does NOT load the contents of the file. I called the URL from Oracle forms using web.show_document. There seems to be issues with Oracle Web forms (JInitiator) and HTML (+ htp.p).
    The other options I can think of at this point are:
    1. Use SQL*Loader to do the batch upload via SQL*Net connection and use HOST() built-in from Oracle Webforms to execute SQL*Loader from the 9iAS.
    2. Write a Visual Basic program that reads a binary file and output the contents of the file into a byte array. Then build a DLL that can be called from Oracle webforms 6i via ORA_FFI. I don't prefer this because it means the solution will only work for Windows.
    3. Write a JSP program that streams the PDF file and insert the contents of the PDF file into blob column via JDBC. Call JSP from forms using web.show_document. With this I have to do another connection to the database when I load the file.
    4. Maybe I can use dbms_lob by using network file system (NFS) between the application server and VMS. But this will be network resource hungry as far as I know because the network connection has to be kept open.
    Please advise. Thank you.
    Regards,
    Armando

    I have downloaded a bin2hex.exe from the Google site.
    ... each line has the character : (colon) at the
    beginning of each line. I'm afraid it isn't a correct utility. I hope you'll find the source code of a correct one at metalink forum:
    Doc ID: 368771.996
    Type: Forum
    Subject: Uploading Binary Files: bin2hex and hex2bin do not reproduce the same file
    There is some links to metalink notes and some example about working with BLOB at http://www.tigralen.spb.ru/oracle/blob/index.htm. Maybe it helps. Sorry for my English. If there is any problem with code provided there, let me know by e-mail.

  • How to upload a binary file with Firefox 7

    Don't know if this is the right forum to ask this - if not, please point me in the right direction.
    I am an embedded developer using Firefox as the user interface to an embedded web server. In the past I've been using file.getAsBinary() to read the local file which is then uploaded with an XMLHttpRequest. Firefox 7 removed the getAsBinary method. Looking through the documentation I came across FileReader and have been trying to use that but with no luck. When I use the readAsBinaryString method, the binary has many bytes which are in error. I have also tried the readAsDataURL but this gives me base64 encoding. Attempts to decode it so far have been unsuccessful. What's the best way to get a local file and upload it to a remote server?
    Thanks,
    Dave

    Well, actually, i have no perfect solution.
    I just used a temporary internal table in which all fields are characters. Then, I used FM GUI_UPLOAD to upload text file including header into this table as usual.
    You can see that it was done successfully. Next, use a loop to transfer this temporary table to the main table. SAP will automatically convert data into values that are compatible with data type in the main table, so don't worry about different types :D.
    In order to make this work more simple, field names of temporary table should be named exactly as same as those in the main one. So, u just use:
    loop at itab_tmp.
      move-corresponding itab_tmp to itab_main.
      append itab_main.
      clear itab_main.
    endloop.
    note: both tables have their own header line, so don't need use a working area here.
    Anyone has any better solution?

  • Upload and read binary files

    I have created ADF form with input file item for initiator human task ( to upload a binary file)
    In the second form, I want see link of the file uploaded and I want open the file in other window ( to see the content of the binary file)
    How can I do?
    Thanks Elena

    Azazel,
    Looks like you are just being an over achiever.  There are VI's specifically written for reading and writing binaries.  I would guess that the VISA timeout is caused by the way you are calculating the size of the file.  Since it is too big the VISA session will time out.  See attached example for the easy way to do this.
    Matt
    Matthew Fitzsimons
    Certified LabVIEW Architect
    LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
    Attachments:
    RWbinary1.vi ‏100 KB

  • To attach/upload binary data file(to vendor) from EP(sends from) to abap

    Hi All,
    I have requirement Enterprise portal(JAVA) will send the file data in binary format to abap.we have to attach the binary data(file) to content server.
    that is for vendor/custmer(XK02/XD02) will have attachments in the sap screen.
    similarly the above screens are provided using enterprise portal (using java) also attachment feature also needs to provide.
    so whenever user imports file form EP screen, they will convert the file into binary format and sends to abap through proxy(custom proxy) abap should attach the binary file to vendor/customer.
    I have checked so_object_upload,so_object_insert, binary relation create --  these FMs are helped using dialog box or providing the path of the file. but couldnt use when the file is in binary format and if it sent form proxy interface.
    could anyone help me in resolving the requirement to upload binary data.

    I use "call function 'ARCHIVOBJECT_CREATE_TABLE'" to process a binary table.  However, in my situation, I'm storing in Documentum.  Once that FM completed, I follow up with call function 'ARCHIV_CONNECTION_INSERT' to store the reference to the document and the archived object in SAP tables.  In your case, you need something that processes the binary table, or you need to utilize one of the "SCMS* " function modules to put your binary table into something that you can use with the other functions.
    The upload from desktop can be done using BIN filetype for GUI_UPLOAD class or function module, or from apps server, you can read your file into an xstring with open dataset....in binary mode....read dataset into your xstring, close dataset.

  • Flat file(Binary file) upload using GUI_UPLOAD

    I had uploaded a Binary file Using GUI_UPLOAD , File type was 'BIN'.
    but the data i got in Internal Table was in 0's and 1's.
    whereas i tried the same thing on a different server but  the same Version it gave me the data as text in Internal Table.
    what could be reason..or wat could be done to resolve this.

    Did you declare the internal table used to upload the binary file as TYPE X ?
    begin of itab,
      raw(255) type x,
    end of itab occurs 0.
    CALL FUNCTION 'GUI_UPLOAD'
       exporting
          filetype =  'BIN'
          filename = 'C:DOWNLOAD.BIN'
       tables
          data_tab = itab.
    Always remember to reward snippets you find useful!

  • How many binary files must be uploaded to apple...

    Do you need to upload a subscription binary .zip as well as a single copy binary .zip?
    for my subscription version it reads...waiting for review.
    On my Current version page it reads....waiting for review and under view details it reads....Waiting for review for version 1.0
    I also provided free sample content and that reads....waiting for review under free subscription.
    But under my In-App purchases it reads Waiting for upload for my non-consumable single issue which I assume from the current version page to be Waiting for review and binary received
    I'm confused as hell now if I sent everything that is needed.  How many diffrent zips go to Apple? 1 or 2 to start this whole process. One for sub and 1 for single? Its all the same content. Except for the freebie version.
    Did this uploading with no sleep after pulling a all-nighter. Now it makes me scared.

    Anyone? 
    My status review says Waiting for review  for my subscrption ID but my single issue says waiting for upload is that cool?
    Does the subscription version need to be approved first for Newsstand then I can test the single issue in the Sandbox?  (Its the same mag and this is the very first issue)
    Its says Newsstand is activate in iTunes Connect.
    On my Ipad my free sample issue shows up and it gives me the subsribe button as well which appeared to work. I am confused when I can see the full issue and test in my ipad in the sandbox.
    I am confused on how this works. Apples servers talk with the Adobe servers and yank accordingly from the corrosponding product ID's? Is that it? All my ID's have been seen by Adobe tech suport for other reasons and all is cool.
    In the DPS app builder I didn't have to also put my single issue product ID as well as my single issue ID in the subscription product window as well....did I?
    All I have now is my subscription product ID. (and that ID reads waiting for review in iTunes Connect.
    I only upoaded one binary file to Apple.
    Part of me feels I did things right but the other part is doing its best to freak me out and make me second guess my actions.
    Did I read somewhere you need to get approval from Apple before you can test in a sandbox environemt anything that is not free content?
    Anywhere on the Adobe site can I find it explained on how Apple & Adobe work with one another and how the product ID's are used etc.  I don't want to wait a week here and find out I missed doing something that I could of avoided. during my "waiting for review" process.

  • JClient Binary File Upload and Insert

    We are looking for ways to upload and insert a pdf or other binary file into a view object using JClient on the client tier. Can anyone point us to sample code for this?

    this should do this
    ApplicationModule appmod = panelBinding.getApplicationModule();
    JUApplication app = panelBinding.getApplication();
    ViewObject vo_calldoc = appmod.findViewObject("CallDocsView1");
    Row newdoc = vo_calldoc.createRow();
    newdoc.setAttribute("CdcCalId", PanelCallView3.vo_call.getRowSet().getCurrentRow().getAttribute("CalId"));
    newdoc.setAttribute("CdcFilenaam",file.getName());
    newdoc.setAttribute("CdcBlob",blob);
    vo_calldoc.insertRow(newdoc);
    appmod.getTransaction().postChanges();
    Object[] inskey = new Object[]{ newdoc.getAttribute("CdcId")};
    appmod.getTransaction().commit();
    Key pkkey = new Key(inskey);
    Row[] rowarray = vo_calldoc.findByKey(pkkey,1);
    Row updrow = rowarray[0];
    System.out.println(updrow.getAttribute("CdcFilenaam"));
    updrow.lock();
    oracle.jbo.domain.BlobDomain myblob = (oracle.jbo.domain.BlobDomain)updrow.getAttribute("CdcBlob");
    int next;
    FileInputStream fileIn = new FileInputStream(file);
    OutputStream blobOut = myblob.getBinaryOutputStream();
    while ((next = fileIn.read()) != -1)
    blobOut.write(next);
    fileIn.close();
    blobOut.close();
    app.commitTransaction();

Maybe you are looking for

  • I can´t update my devices apple from company

    I install manually iTunes to my corporate computer last month, and works perfect, syncronize, update and all fine and 100%. So this week in my company distribute the iTunes automatically.... and the sttop this possibility, I don´t how do this, when I

  • Taxinn Procedure

    Hi all, We are using taxinn procedure to calculate the taxes. How can anybody  justify the selection of Taxinn , when there are hundreds of vendors , materials and in Taxinn then we have to maintain so many records in FV11.Why should we use it then?

  • Data Warehouse Cubes Not Processing

    With a customer now who is having data warehouse problems, the main issues being: - ETL jobs run fine (except MPSync which finishes with only 179/180 jobs complete) - Cube processes are stuck in a RUNNING loop, they never complete or fail out and all

  • Automatically play next flv movie... 5 times

    I know how to get a video on the stage and get it to play an flv, then switch at the end... vid.contentPath = "MovieName_1.flv"; var vidList : Object = new Object(); vidList.complete = function() { vid.contentPath = "MovieName_2.flv"; vid.addEventLis

  • Perché quando aggiungo un'immagine a un album essa non viene visualizzata sull'ipod?

    Aggiungo foto, testo, artista ,album ma non vengono visualizzate sull'ipod... soluzioni? (la canzone c'è ma non ha descrizioni modificate come le voglio io)