Question regrading uploading file on Flex and reading the on Java server

Hello
I am using Java on the server side and i am uploading a file using file reference on the client side using adobe flex 3 and passing it to the server side using http post and i am having trouble saving the file to database. I am also using hibernate, springframework, Jboss server and Mysql 5 database this is my flex code. I know for a fact that it is hitting the servlet page so i am just can't read the file.
private function startUpload():void
                    if (_arrUploadFiles.length > 0) {
                         disableUI();
                         listFiles.selectedIndex = _numCurrentUpload;
                         scrollFiles();
                         var sendVars:URLVariables = new URLVariables();
                         sendVars.action = "upload";
                         var request:URLRequest = new URLRequest();
                         request.data = sendVars;
                    request.url = _strUploadUrl;
                    request.method = URLRequestMethod.POST;
                    _refUploadFile = new FileReference();
                    _refUploadFile = listFiles.selectedItem.file;
                    _refUploadFile.addEventListener(ProgressEvent.PROGRESS, onUploadProgress);
                         _refUploadFile.addEventListener(Event.COMPLETE, onUploadComplete);
                    refUploadFile.addEventListener(IOErrorEvent.IOERROR, onUploadIoError);
                         refUploadFile.addEventListener(SecurityErrorEvent.SECURITYERROR, onUploadSecurityError);
                    _refUploadFile.upload(request, "file", false);
This is my java code and i have tried so many different ways of getting this file but have hit a brick wall and i have no other ideas
package com.file.exchange.service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import java.io.*;
import java.sql.Blob;
import com.file.exchange.vo.Files;
import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.File;
import java.util.Enumeration;
public class FileUpload extends FileBaseService
     private static final String CONTENT_TYPE = "text/xml; charset=utf-8";
     @Override
     protected String getXmlFromOperation(HttpServletRequest request,HttpServletResponse response) throws Exception
          //ServletOutputStream servletOutputStream = response.getOutputStream();
          //Object fileObject = new Object(response.getOutputStream().);
          //InputStream is = new InputStream() ;
          //InputStreamReader input = new InputStreamReader(request.getInputStream());
          //BufferedReader buffer = new BufferedReader(input);
          DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
          Date date = new Date();
          String data = "hello world";
          String id = "1";//getCharacterDataFromElement(vID);
          String name = String.valueOf(request.getAttributeNames());//getCharacterDataFromElement(vname);
          String type = ".txt";//getCharacterDataFromElement(vtype);
          String size = "5555";//Long.toString(fileObject.length());//getCharacterDataFromElement(vsize);
          Blob content = org.hibernate.Hibernate.createBlob(data.getBytes());//fisFile);//data.getbytes[]
          String date_uploaded = dateFormat.format(date);
          Files file = getFileDao().uploadFile(Integer.parseInt(id), name, type, Integer.parseInt(size), content, date_uploaded);
          return file.toXml();
}

You need to parse the request as multipart/form-data.
Maybe [http://commons.apache.org/fileupload/|http://commons.apache.org/fileupload/] can help.

Similar Messages

  • Read a csv file and read the fiscal yr in the 4th pos?

    Hello ABAP Experts,
    how to write a code for read a csv file and read the fiscal year in the 4th position.
    any suggestions or code highly appreciated.
    Thanks,
    BWer

    Hi Bwer,
    Declare table itab with the required fields...
    Use GUI UPLOAD to get the contents of the file (say abc.csv) in case if the file is on the presentation server...
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = 'c:\abc.csv'
       FILETYPE                        = 'ASC'
        WRITE_FIELD_SEPARATOR           = 'X'
      tables
        data_tab                        = itab
    EXCEPTIONS
       FILE_WRITE_ERROR                = 1
       NO_BATCH                        = 2
       OTHERS                          = 22
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use OPEN DATASET in case if the file is on the application server..
    After that USE SPLIT command at comma to get the contents of the 4th field...
    Regards,
    Tanveer.
    <b>Please mark helpful answers</b>

  • Greetings from a Photoshop Newbie. I need a computer, preferably a Mac laptop, with some serious processing power. I take photos with a Pentax 645Z; files are 50MB raw. I upload from Adobe Bridge and manipulate the photo, sometimes turning them into files

    Greetings from a Photoshop Newbie. I need a computer, preferably a Mac laptop, with some serious processing power. I take photos with a Pentax 645Z; files are 50MB raw. I upload from Adobe Bridge and manipulate the photo, sometimes turning them into files in excess of 250MB. I cannot resize as the large files are needed for enlargements. Have all sorts of problems trying to manipulate, add effects and saving most large files. I need some serious processing power. Can anyone suggest what Mac i should purchase? I thank you in advance for your help :-)

    It sounds as if you're having some system-related problems now, unrelated to processing power as such. In particular, a buggy video driver can cause everything to slow to a crawl.
    Medium format files are big, true, but not so big as to cause significant slowdowns on a normally functioning and reasonably current computer. A laptop will always be slower than a well-equipped desktop system, though. Mac vs PC plays no part in this, performance is unrelated to platform.
    Bottlenecks are different in ACR and Photoshop, so that should give you a clue. ACR is computing-intensive and mostly limited by CPU speed. Photoshop, however, is mostly bandwidth-intensive and mainly limited by memory and disk throughput. It's also sensitive to GPU issues.

  • How to upload words, exel, PDF file from the pc via itune to the iPad, and where will the uploaded file be saved? In the apps?

    How to upload words, exel, PDF file from the pc via itune to the iPad, and where will the uploaded file be saved? In the apps?

    You will need an app (or apps) on your iPad that is capable of reading the documents, as they will be saved with the app - if you don't have such an app then there is nothing to transfer them to or to read/access them.
    One method of transferring them is toconnect your iPad to your computer's iTunes, select it's app tab, and then scroll to the bottom of it - you should the apps That you've got that are capable of file-sharing (if you've got any).  Selecting/high-lighting one of them should then allow you to add files to it via the box to the right of it.
    An alternative way to get the documents onto your iPad is if the app that you want to transfer them to has a wifi setting, which will then allow you to transfer the documents wirelessly. You can also send the documents to yourself as attachments and then use Mail's 'open in' facility to copy them into your chosen app.
    Edit : more info on file sharing from the manual :
    File Sharing lets you transfer files between iPad and your computer. You can share files created with a compatible app and saved in a supported format.
    Apps that support file sharing appear in the File Sharing Apps list in iTunes. For each app, the Files list shows the documents that are on iPad. See the app’s documentation for how it shares files; not all apps support this feature.
    Connect iPad to your computer.
    In iTunes, select iPad in the Devices list, then click Apps at the top of the screen.
    In the File Sharing section, select an app from the list on the left.
    On the right, select the file you want to transfer, then click “Save to” and choose a destination on your computer.
    Transfer a file from your computer to iPad:
    Connect iPad to your computer.
    In iTunes, select iPad in the Devices list, then click Apps at the top of the screen.
    In the File Sharing section, click Add.
    Select a file, then click Choose (Mac) or OK (PC).
    The file is transferred to your device and can be opened using an app that supports that file type. To transfer more than one file, select each additional file.
    Delete a file from iPad: Select the file in the Files list, then tap Delete.
    Message was edited by: King_Penguin

  • Modifying and reading the WSDL file

    I�ve got some questions about modifying and reading the WSDL file:�
    READING
    I want to read the elements of a determinated type (for example, documentation) from an WSDL that is in an URI. How can I do it?
    I�ve been trying with the api from IBM WSDL4J, but I wasnt able to create an Element from type "documentation" to search it (if that is the way...)
    MODIFYING
    How can I insert in an WSDL file a new element (for example documentation) in an exactly place?
    Any help is grateful,
    Thanks in advance
    Gobellot

    The problem is I want to insert documentation elements (and that is not done automatically by the jwsdp (unless i dont know how to do it, please tell me if there is a way) and I want to interpret too some things from the documentation elements so I have to read it separately because de wsdltojava doesnt do anything special for that.
    thanks anyway
    Gobellot

  • How can i upload files in servlets and also using jsp

    means that uploading files(.doc) or any files by using servlets and jsps

    yawmark wrote:
    saichand wrote:
    means that uploading files(.doc) or any files by using servlets and jsps
    [http://www.google.com/search?q=How+can+i+upload+files+in+servlets+and+also+using+jsp]
    ~Good topic titles are indeed brilliant search keywords. It's sad to see that it won't even come in the mind of the topicstarters to Google it before posting the topic.

  • Question about upload file to sever in jsp.

    i found some articles about upload file in jsp, and most of suggested that the third party classes will be used.
    but i want to know the basic technology behind them, for example what kind of class needed ( using java.io.* as usual)
    and what the process for writing a file to sever.
    any document or url link useful will be very welcomed.
    best regards

    Uploading a file is similar to sending any other kind of data, except that it must be encoded differently than a standard HTML form... Typically you will set up your form like this:
    <form action="/upload" enctype="multipart/form-data" method="POST">
    <input type="file" name="myFile">
    </form>
    The enctype declaration is necessary -- your file won't arrive intact any other way. However, the JSP/Servlet specs don't provide any code to deal with forms which are encoded this way, so things like request.getParameter() don't work. You will either have to roll your own code, or use a third party library.
    For more information, see RFC 1867, File upload in HTTP:
    http://www.faqs.org/rfcs/rfc1867.html

  • Writing the file using Write to SGL and reading the data using Read from SGL

    Hello Sir, I have a problem using the Write to SGL VI. When I am trying to write the captured data using DAQ board to a SGL file, I am unable to store the data as desired. There might be some problem with the VI which I am using to write the data to SGL file. I am not able to figure out the minor problem I am facing.  I am attaching a zip file which contains five files.
    1)      Acquire_Current_Binary_Exp.vi -> This is the VI which I used to store my data using Write to SGL file.
    2)      Retrive_BINARY_Data.vi -> This is the VI which I used to Read from SGL file and plot it
    3)      Binary_Capture -> This is the captured data using (1) which can be plotted using (2) and what I observed is the plot is different and also the time scare is not as expected.
    4)      Unexpected_Graph.png is the unexpected graph when I am using Write to SGL and Read from SGL to store and retrieve the data.
    5)      Expected_Graph.png -> This is the expected data format I supposed to get. I have obtained this plot when I have used write to LVM and read from LVM file to store and retrieve the data.
    I tried a lot modifying the sub VI’s but it doesn’t work for me. What I think is I am doing some mistake while I am writing the data to SGL and Reading the data from SGL. Also, I don’t know the reason why my graph is not like (5) rather I am getting something like its in (4). Its totally different. You can also observe the difference between the time scale of (4) and (5).
    Attachments:
    Krishna_Files.zip ‏552 KB

    The binary data file has no time axis information, it is pure y data. Only the LVM file contains information about t(0) and dt. Since you throw away this information before saving to the binary file, it cannot be retrieved.
    Did you try wiring a 2 as suggested?
    (see also http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=925 )
    Message Edited by altenbach on 07-29-2005 11:35 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Retrive_BINARY_DataMOD2.vi ‏1982 KB

  • Get Uploaded File Mime Type and Client Filename

    Anyone know how to recover an uploaded file MIME type and
    client file name?
    I'm writing my own cfx tag to process file uploads and pretty
    much have it figured out except to determine the name of the client
    file and mime type. The formfield file variable value contains the
    path/filename to the CF temp directory, but I need the MIME type,
    filename, etc. that is contained int he HTTP Header
    (e.g. Content-Disposition: form-data; name="Image";
    filename="C:\test.JPG"
    Content-Type: image/pjpeg
    [empty line])
    I'm using the getHttpRequestData() functiont, but it only
    gives me the content-type multipart/form-data, leaving out the Mime
    type and Content-Disposition (which contains the client file name).

    Hi Daniel,
    do you use EPG, mod_plsql or APEX Listener? Have you changed the connection mechanism after upgrading to 4.2.1?
    If you use the APEX Listener, which version do you use? Which browser and version do you use to upload the file? Does it reproduce with other browsers as well?
    Regards
    Patrick
    Member of the APEX development team
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Cfspreadsheet and reading the xlsx files issue

    I am trying to process large excel files (65,000 rows) into the DB.  So I try to use the new cfspreadsheet tag to read in the files by 5000 rows at a time and then process the query into the tables.  The process is working fine when reading the (pre 2003 format "xls" files) but not when reading the new "xlsx" type of files.  The server is running out of memory trying to read those files for some reason.  Is this a known bug in ColdFusion 9.0??  Has anyone experiansed similar issues?
    Thanks

    if it's a POI issue (not likely, admittedly), of CF's
    usage thereof.
    If you check the POI archives, you should see a LOT of memory issues with large xlsx files. Usually related to how the file is processed. IIRC the standard way of loading a spreadsheet ie new XSSFWorkbook(name) just reads the whole file into memory in one shot. So with all the bloated xml and parsing going on it is very prone to OOM errors.
    For big files, they actually recommend using the event api instead, because of its lower footprint. I used it a couple months ago for a side project and it made a huge difference!  I did some basic profiling and the standard method (usermodel) was definitely more prone to big spikes in memory and oom errors. In contrast, memory usage with event api was far lower and more stable.
    Reason for bringing this all of this up ...? Well depending on how CF actually reads/loads spreadsheets internally, maybe the problem is a little bit of both .. ?  Just my $0.02
    -Leigh
    Message was edited by: -==cfSearching==-

  • Find and Read the Target Spreadsheet File from Target Folder

    I'm trying to find and read the target spreadsheet file from the target folder. Please help. Thanks.
    Solved!
    Go to Solution.

    If you know the folder, you could do a List Folder Contents to get a list of files in that folder.  You can then just use Array Index to get the file you want.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • File explorer application and reader folder xperia

    can you please explain what and where these are and how to access them, thanks.
    Solved!
    Go to Solution.

    Hi
    I think there’s no “file explorer application and reader folder xperia”!
    There’s only an app named “File transfer”…
    or  you can use “file explorers” of other apps (like OfficeSuite, if available, to navigate on folders…)
    The only real solution, is to download an app from Play Store.
    I use “File Manager”(Explorer) or “File Manager HD”(Tablet) (Rhythm Software) free.
    Jannis

  • I have a friend who I was helping out with his iPhone. He has since lost it. I believe I backed it up to my machine but have no idea where to find it. Is it possible to find it and read the back-up file without the original device being connected?

    I have a friend who I was helping out with his iPhone. He has since lost it. I believe I backed it up to my machine but have no idea where to find it. Is it possible to find it and read the back-up file without the original device being connected?

    If he gets another device - you should be able to restore it from your computer to the point where you backed it up
    Otherwise that file cannot be read

  • Using Lightroom 4 w/ Windows 7.  Recently started shooting w/ Sony camera .arw files.  Lightroom cannot read the files.  Loaded Adobe converter program onto the computer and this program cannot read the files either.  Any suggestions?

    Using Lightroom 4 w/ Windows 7.  Recently started shooting w/ Sony camera that shoots .arw files.  Lightroom cannot read the files.  Loaded Adobe converter program onto the computer and this program cannot read the files either.  Any suggestions?

    Thnx again for the reply.  The version of Lightroom I have is 4.0  (working w/Windows 7)  This computer and all media files are kept off-line After doing more research, I downloaded DNG Converter 7.1This loaded into a .zip folder, which I am planning to install into the off-line computer andrun.  Where does this folder go?
    And will this set up work with my version of Lightroom?
    What a pain.  Makes me wanna go back to shooting .nef files for all stills
    Thnx

  • When I am open file with adobe Pro and reader the resolution in my computer failing, change the resolution from 1920x1200 to 800x600. my video card is nvidia quadro 2000. w7 & 32 bits

    when I am open file with adobe Pro and reader the resolution in my computer failing, change the resolution from 1920x1200 to 800x600. my video card is nvidia quadro 2000. w7 & 32 bits

    Hi fabiangs,
    I'm not sure that I follow. Are you saying that when you open a PDF file in Acrobat or Reader, that the display resolution changes automatically on your system?
    What version of Acrobat/Reader are you using? Do you see this same issue in other files/applications?
    I look forward to hearing back from you.
    Best,
    Sara

Maybe you are looking for

  • A/R / A/P Aging question

    Our customer frequently needs to run aging reports as of a date in the past (i.e. they are running 11/30/13 right now).  In order to get the report to tie to the trial balance, we need to select criteria to include customers/vendors with a -0- balanc

  • Unable to deploy database in mirror

    Hello, I'm trying to install mirror database with Lync but it's not working. I used :  Install-CsMirrorDatabase -ConfiguredDatabases -FileShare \\sqlf13-01\export -SqlServerFqdn LYNCSQL13-01 - DropExistingDatabasesOnMirror -Verbose Error message : In

  • XSLT Date Formatting

    Hi, I have an xml document that I am parsing using an xsl stylesheet (to give a CSV file). The xml document contains dates in millisecond format, such as 983404800000 (i.e. the same format you would get from System.currentTimeMillis()). Would it be p

  • Many to One in Triggers

    Hello, I am writing a Trigger that needs to perform the following , if there is any change in any of columns of Table A I need to propagate the same to Table B . By changes I mean insert(s)/update(s) or delete(s). if table A has one row representing

  • Can't Open ASDM in Mountain Lion

    I'm trying to launch ASDM 6.4(5) for the first time to access our company's firewall, but I can't launch it. My manager has no problem, but he's on 10.7 and Java 6. I'm on Java 7. When I Run ASDM, a Java 7 splash screen pops up and never goes away. S