Correct Approach in uploading a file

Which is the correct approach in uploading an image file.
Upload the file to the ApplicationServer and save the path in the DataBase
OR
Upload the file to the DataBase as BLOB.

Usually I think you should just be storing the
location of the image in the database rather than the
image itself. However there are a couple of
disadvantages, chiefly that you need to keep the
database and file system in sync with each other and
that you don't have the database security to protect
your images.Perhaps more importantly (depending on your setup) there's the problem of accessing these auxilliary files from different hosts, and keeping the directory tidy. You can, of course, generally access through NFS but then your configuration on different machines had to take account of different file paths.
And you've got a second set of permissions to worry about.

Similar Messages

  • Upload xml file from aplication server using read dataset, parser error.

    Hi,
    I would like to upload xml file from app. server but parser failed. If I upload this xml file from workstation (using ws_upload) it is correct. For uploading xml file from app. server I use open dataset... read dataset. In loop section I remove '#' char. How do You upload xml file from app server? What Could be incorrect.
    I try to open dataset in binary mode, text mode...
    TYPES: BEGIN OF xml_line,
            data(255) TYPE c,
          END OF xml_line.
    DATA: gt_xml_table TYPE TABLE OF xml_line,
          gs_xml_structure TYPE  xml_line,
          gv_xml_table_size TYPE i.
    OPEN DATASET s FOR INPUT IN BINARY MODE.
      IF sy-subrc <> 0.
        MESSAGE e001(zet) WITH '....'.
      ENDIF.
      DO.
        READ DATASET s INTO gs_xml_structure.
        IF sy-subrc <> 0.
          EXIT.
        ELSE.
         len = STRLEN( gs_xml_structure ).
         len = len - 1.
         check len > 0.
         WRITE gs_xml_structure(len) TO gs_xml_structure.
          APPEND gs_xml_structure TO gt_xml_table.
        ENDIF.
      ENDDO.

    You Can do this too
    parameters: p_file like rlgrap-filename.
    data: subrc like sy-subrc.
      create object me.
      REFRESH t_data.
    *  Open XML File
      CALL METHOD me->CREATE_WITH_FILE
        EXPORTING
          filename = p_file
        RECEIVING
          retcode  = subrc.
    * Saves Data in an itab from XML File.
      CALL METHOD me->get_data
        IMPORTING
          retcode    = subrc
        CHANGING
          dataobject = t_data[].
    Regards,
    Claudio.

  • Upload multiple files WITH correct pairs of form fields into Database

    In my form page, I would like to allow 3 files upload and 3 corresponding text fields, so that the filename and text description can be saved in database table in correct pair. Like this:
    INSERT INTO table1 (filename,desc) VALUES('photo1.jpg','happy day');
    INSERT INTO table1 (filename,desc) VALUES('photo2.jpg','fire camp');
    INSERT INTO table1 (filename,desc) VALUES('photo3.jpg','christmas night');
    However, using the commons fileupload, http://commons.apache.org/fileupload/, I don't know how to reconstruct my codes so that I can acheieve this result.
    if(item.isFormField()){
    }else{
    }I seems to be restricted from this structure.
    The jsp form page
    <input type="text" name="description1" value="" />
    <input type="file" name="sourcefile" value="" />
    <input type="text" name="description2" value="" />
    <input type="file" name="sourcefile" value="" />The Servlet file
    package Upload;
    import sql.*;
    import user.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.Map;
    import java.util.HashMap;
    import java.util.Date;
    import java.util.List;
    import java.util.Iterator;
    import java.io.File;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.text.SimpleDateFormat;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.*;
    public class UploadFile extends HttpServlet {
    private String fs;
    private String category = null;
    private String realpath = null;
    public String imagepath = null;
    public PrintWriter out;
    private Map<String, String> formfield = new HashMap<String, String>();
      //Initialize global variables
      public void init(ServletConfig config, ServletContext context) throws ServletException {
        super.init(config);
      //Process the HTTP Post request
      public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        Thumbnail thumb = new Thumbnail();
        fs = System.getProperty("file.separator");
        this.SetImagePath();
         boolean isMultipart = ServletFileUpload.isMultipartContent(request);
         if(!isMultipart){
          out.print("not multiple part.");
         }else{
             FileItemFactory factory = new DiskFileItemFactory();
             ServletFileUpload upload = new ServletFileUpload(factory);
             List items = null;
             try{
                items = upload.parseRequest(request);
             } catch (FileUploadException e) {
                e.printStackTrace();
             Iterator itr = items.iterator();
             while (itr.hasNext()) {
               FileItem item = (FileItem) itr.next();
               if(item.isFormField()){
                  String formvalue = new String(item.getString().getBytes("ISO-8859-1"), "utf-8");
                  formfield.put(item.getFieldName(),formvalue);
                  out.println("Normal Form Field, ParaName:" + item.getFieldName() + ", ParaValue: " + formvalue + "<br/>");
               }else{
                 String itemName = item.getName();
                 String filename = GetTodayDate() + "-" + itemName;
                 try{
                   new File(this.imagepath + formfield.get("category")).mkdirs();
                   new File(this.imagepath + formfield.get("category")+fs+"thumbnails").mkdirs();
                   //Save the file to the destination path
                   File savedFile = new File(this.imagepath + formfield.get("category") + fs + filename);
                   item.write(savedFile);
                   thumb.Process(this.imagepath + formfield.get("category") +fs+ filename,this.imagepath + formfield.get("category") +fs+ "thumbnails" +fs+ filename, 25, 100);
                   DBConnection db = new DBConnection();
                   String sql = "SELECT id from category where name = '"+formfield.get("category")+"'";
                   db.SelectQuery(sql);
                    while(db.rs.next()){
                      int cat_id = db.rs.getInt("id");
                      sql = "INSERT INTO file (cat_id,filename,description) VALUES ("+cat_id+",'"+filename+"','"+formfield.get("description")+"')";
                      out.println(sql);
                      db.RunQuery(sql);
                 } catch (Exception e){
                    e.printStackTrace();
            HttpSession session = request.getSession();
            UserData k = (UserData)session.getAttribute("userdata");
            k.setMessage("File Upload successfully");
            response.sendRedirect("./Upload.jsp");
      //Get today date, it is a test, actually the current date can be retrieved from SQL
      public String GetTodayDate(){
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        String today = format.format(new Date());
        return today;
      //Set the current RealPath which the file calls for this file
      public void SetRealPath(){
        this.realpath = getServletConfig().getServletContext().getRealPath("/");
      public void SetImagePath(){
        this.SetRealPath();
        this.imagepath = this.realpath + "images" +fs;
    }Can anyone give me some code suggestion? Thx.

    When one hits the submit button - I then get a 404 page error.What is the apaches(?) error log saying? Mostly you get very useful information when looking into the error log!
    In any case you may look at how you are Uploading Multiple Files with mod_plsql.

  • When I try to upload a file it goes through the correct proceedure, but does not change the remote file i.e.Index.htm

    Hi
    I have an uploading problem to the server. The problem is when I try to upload a file it goes through the correct proceedure,
    but does not change the remote file i.e.Index.htm, or three stages1.htm.
    My Localroot folder is C:\Gods Plan Web\
    The site map layout is C:\Gods Plan Web\Index.htm
    The folder for the remote site is /public_html/
    Should the local root folder mirror the remote site, i.e./public_html/
    if this is so, what should I put into the
    (a) Local Root Folder box?
    (b) site map layout box?
    The FTP is performing well other than changing the intended file.

    You should be uploading only the contents of your local root to the public_html folder (remote root).
    The index.html you use as your site's home page needs to be in your site root. If you look at your Files window in DW, you should have something like the following...
    Site - Whatever you named your site
         index.html
         images
         pages
              page1.html
              page2.html
    If you have any folder between Site - and the index.html page, like...
    Site - Whatever you named your site
         mywebsite
              index.html
    It will upload to the public_html while still in that folder, so to find your page online, you would need to type something like...
    www.mydomain.com/mywebsite
    public_html should NOT appear within your local files and if it existed there, would cause a redundancy if uploaded. You would need to type www.yourdomain.com/public_html to see the uploaded pages.
    If you could post a screen shot of your expanded Files window while connected to the server (just connect and click the Expand button in Files, don't drill down into any of the directories), we may be able to see the issue.

  • Uploaded image files not displayed correctly

    Hello everyone,
    I used the following article(on o'reilly) as reference for file upload:
    http://www.onjava.com/pub/a/onjava/2001/04/05/upload.html?page=1
    While it works fine for most files types, there are problems with image files.(I am using PrintStream, BufferedOutputStream,FileOutputStream to write the files on the server).
    When links to these image files are clicked, the uploaded gif and jpeg image files are not displayed correctly.When directly opening the files on the server, it gives a 'error opening file' message.But other word docs , text files do not give an error.
    If anyone else has come across the same problem and could help out , I would appreciate it.
    Thanks in advance.

    I do not want to enter into the logic which you are following to upload the file. I did the upload process successfully even as a blob datatype.
    For this I followed the logic given in http://www.java.isavvix.com/codeexchange/codeexchange-viewdetail.jsp?id=22.
    Here you can download the complete sourse code, which is working fine for gif and jpeg, I tested.
    Please go with this. Also let me know, if you still have problem.
    Regards.

  • To whom this may concern, I'm having troubles with uploading Flash Files Online throught Adobe Flash Professional and I would to correct the Error Messages I've received as an indication that I need to correct them in order to test a Flash and Shockwave F

    To whom this may concern, I'm having troubles with uploading Flash Files Online throught Adobe Flash Professional and I would to correct the Error Messages I've received as an indication that I need to correct them in order to test a Flash and Shockwave Files I have stored into the Software of Flash!. Could you please help me get this matter resolved? Gerard Hargrove.

    what exactly are you trying to do and attach a screenshot of the error message, if it's in english.

  • 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 file in application server to an internal table

    Hi,
          I am asked to upload a file from application server to internal table. Can you please suggest me the ways to do it or the function module which helps to browse the application server file names.
      I have done a program. But its giving problem in searching the files from application server. I am pasting my code for ur review. Please tell me which part i have to correct or suggest me some other ways to do it.
    *& Report  ZUPLOAD1
    REPORT  ZUPLOAD1.
    type-pools: truxs.
    parameters: p_upl_ps radiobutton group g1 default 'X', "upload from pres. server
                 p_path type rlgrap-filename, 
                 p_upl_as radiobutton group g1,   "upload from appln server
                 <b>p_dir LIKE filepath-pathintern DEFAULT 'Y_ABAP', 
                 p_file LIKE filepath-pathintern lower case,</b>      
                 p_test as checkbox.
    constants: c_x value 'X',
               c_tab type c value cl_abap_char_utilities=>horizontal_tab.
    types: ty_data(1000) type c.    "structure to hold legacy data
    data: i_data type standard table of ty_data. "internal table of ty_data
    types: begin of stritab,
          land1 type v_t604-land1,  "structure of legacy file.
          stawn type v_t604-stawn,
          bemeh type v_t604-bemeh,
          impma type v_t604-impma,
          minol type v_t604-minol,
          end of stritab.
    data: gi_itab type standard table of stritab, "internal table of legacy file
          gw_itab type stritab.  "work area
    data: i_raw type truxs_t_text_data,
          v_fullpath type string.
    at selection-screen on value-request for p_path.
    if p_upl_ps = c_x. "if presentation server is selected
    perform get_file.
    else.            "if application server is selected
    perform set_file_path.      
    perform upload_from_server.
    perform split_data.
    endif.
    form get_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = p_path.     "getting the file name of pres server
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
      EXPORTING
      I_FIELD_SEPERATOR          =
        I_LINE_HEADER              = 'X'              "converting excel to sap and filling in
        I_TAB_RAW_DATA             = i_raw      "internal table
        I_FILENAME                 = p_path
      TABLES
        I_TAB_CONVERTED_DATA       = gi_itab
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.
    form set_file_path.                 "Getting the file path of application server
    data: lv_file type p_file.
          lv_file = p_file.
          CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
            EXPORTING
            CLIENT                           = SY-MANDT
              LOGICAL_PATH                     = p_dir
            OPERATING_SYSTEM                 = SY-OPSYS
            PARAMETER_1                      = ' '
            PARAMETER_2                      = ' '
            PARAMETER_3                      = ' '
            USE_BUFFER                       = ' '
              FILE_NAME                        = lv_file
            USE_PRESENTATION_SERVER          = ' '
            ELEMINATE_BLANKS                 = 'X'
           IMPORTING
             FILE_NAME_WITH_PATH              = v_fullpath
           EXCEPTIONS
             PATH_NOT_FOUND                   = 1
             MISSING_PARAMETER                = 2
             OPERATING_SYSTEM_NOT_FOUND       = 3
             FILE_SYSTEM_NOT_FOUND            = 4
             OTHERS                           = 5
          IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    endform.
    form upload_from_server.
    data: lv_msg type string,
          lw_data type ty_data.
    open dataset v_fullpath for input message lv_msg in text mode encoding default.
    if sy-subrc <> 0.
    message lv_msg type 'i'.
    stop.
    endif.
    do.
    read dataset v_fullpath into lw_data.
    if sy-subrc <> 0.
    write:/5 'Error in processign data set'.
    exit.
    endif.
    append lw_data to i_data.
    enddo.
    close dataset v_fullpath.
    if sy-subrc <> 0.
    write: /5 'Error closing dataset'.
    endif.
    endform.
    form split_data.
    data: lw_data type ty_data.
    data: lw_itab type stritab.
    data: begin of ty_itab,
          land1 type v_t604-land1,
          stawn type v_t604-stawn,
          bemeh type v_t604-bemeh,
          impma type v_t604-impma,
          minol type v_t604-minol,
          end of ty_itab.
    loop at i_data into lw_data.
    split lw_data at c_tab into
          ty_itab-land1
          ty_itab-stawn
          ty_itab-bemeh
          ty_itab-impma
          ty_itab-minol.
    lw_itab-land1 = ty_itab-land1.
    lw_itab-stawn = ty_itab-stawn.
    lw_itab-bemeh = ty_itab-bemeh.
    lw_itab-impma = ty_itab-impma.
    lw_itab-minol = ty_itab-minol.
    append lw_itab to gi_itab.
    endloop.
    endform.
    start-of-selection.
    loop at gi_itab into gw_itab.
    write: /5 'COUNTRY', 'IMPORT CODE', 'SUP UNIT', 'FIRST UOM', 'SECOND UOM',
           /5 gw_itab-land1, gw_itab-stawn,gw_itab-bemeh,gw_itab-impma,gw_itab-minol.
    endloop.
    end-of-selection.
    I hope problem must be in p_dir and p_file which are in bold.. Kindly help me out. Thanks in advance.

    see the following ex:
    *&      Form  SUB_GET_FILEPATH
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_GET_FILEPATH .
        GFILE = 'D:\SAP_INT\INBOUND\INBOX'.  "Path
    ENDFORM.                    " SUB_GET_FILEPATH
    *&      Form  SUB_GET_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM SUB_GET_FILE .
      DATA: P_FDIR(200) TYPE C.
      DATA: IT_FILEDIR1 TYPE STANDARD TABLE OF TY_FILEDIR WITH HEADER LINE.
      P_FDIR = GFILE.
      CALL FUNCTION 'RZL_READ_DIR_LOCAL'
        EXPORTING
          NAME     = P_FDIR
        TABLES
          FILE_TBL = IT_FILEDIR.
      REFRESH : IT_FILEDIR1.
      LOOP AT IT_FILEDIR.
        IF IT_FILEDIR-NAME(4) = 'ZINC' OR IT_FILEDIR-NAME(4) = 'zinc'.
          MOVE IT_FILEDIR-NAME TO IT_FILEDIR1-NAME.
          APPEND IT_FILEDIR1.
        ENDIF.
      ENDLOOP.
      IF IT_FILEDIR1[] IS INITIAL.
        STOP.
      ENDIF.
      LOOP AT IT_FILEDIR1.
        REFRESH: I_TAB.
        CLEAR: I_TAB.
        NAME = IT_FILEDIR1-NAME.
        CONCATENATE: GFILE '\' NAME INTO G_FILE.
        OPEN DATASET G_FILE FOR INPUT IN TEXT MODE
                                         ENCODING DEFAULT
                                         IGNORING CONVERSION ERRORS.
        IF SY-SUBRC EQ 0.
          CONCATENATE 'FILENAME  : ' G_FILE INTO I_MSG1.
          APPEND I_MSG1.
          DO.
            READ DATASET G_FILE INTO RECORD.
            IF SY-SUBRC = 0.
              SPLIT RECORD AT ',' INTO I_TAB-BUKRS  I_TAB-EBELN
                  I_TAB-BLDAT  I_TAB-XBLNR I_TAB-LIFNR I_TAB-AMOUNT
                  I_TAB-CURR  I_TAB-BUSAREA
                  I_TAB-BKTXT I_TAB-DMBTR I_TAB-MENGE I_TAB-SRNO.
              MOVE-CORRESPONDING I_TAB TO I_TAB1.
            ELSE.
              EXIT.
            ENDIF.
            APPEND I_TAB1.
            CLEAR: I_TAB, I_TAB1.
          ENDDO.
        ENDIF.
        CLOSE DATASET G_FILE.

  • HOW CAN U CORRECT THE DATA IN UR FILE WHICH CONTAINS 1 LAKSH RECS

    Hai Frnds,
    i Attend an interview they asked this questions can u know the answeres . tell me .
    In File to file scenario how can we reprocess records which failed records.
    HOW CAN U CORRECT THE DATA IN UR FILE WHICH CONTAINS 1 LAKSH RECS
    Thanks in advance
    thahir

    Hi,
    Refer these links:
    this might help you
    Generic Approach for Validating Incoming Flat File in SAP XI - Part 1
    Generic Approach for Validating Incoming Flat File in SAP XI - Part 1
    validating against schema file for the output XML file
    Informing the sender about bad records
    Regards,
    Nithiyanandam

  • To upload a file from client machine to server machine

    Hi everybody!
    Could anyone plz help me. I am struck in a problem
    I want to transfer a file from client's machine to server but I am not able to upload
    It is tranferring the file only to the local machine
    I am using orielley package It is transferring files only to my local machine but not to the server .Can anyone correct it. It's very urgent
    how to write the relative path for server
    I am using this path and it is not uploading
    MultipartRequest multi = new MultipartRequest(request, "../<administrator>:<dev2daask>@dev2:C:/123data/", 5 * 1024 * 1024);
    Here is my code:
    <%@ page import="java.util.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="com.oreilly.servlet.MultipartRequest"%>
    <%
    try {
    // Blindly take it on faith this is a multipart/form-data request
    // Construct a MultipartRequest to help read the information.
    // Pass in the request, a directory to saves files to, and the
    // maximum POST size we should attempt to handle.
    // Here we (rudely) write to the server root and impose 5 Meg limit.
    MultipartRequest multi = new MultipartRequest(request, "../<administrator>:<dev2daask>@dev2:C:/123data/", 5 * 1024 * 1024);
    out.println("<HTML>");
    out.println("<HEAD><TITLE>UploadTest</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<H1>UploadTest</H1>");
    // Print the parameters we received
    out.println("<H3>Params:</H3>");
    out.println("<PRE>");
    Enumeration params = multi.getParameterNames();
    while (params.hasMoreElements()) {
    String name = (String)params.nextElement();
    String value = multi.getParameter(name);
    out.println(name + " = " + value);
    out.println("</PRE>");
    // Show which files we received
    out.println("<H3>Files:</H3>");
    out.println("<PRE>");
    Enumeration files = multi.getFileNames();
    while (files.hasMoreElements()) {
    String name = (String)files.nextElement();
    String filename = multi.getFilesystemName(name);
    String type = multi.getContentType(name);
    File f = multi.getFile(name);
    out.println("name: " + name);
    out.println("filename: " + filename);
    out.println("type: " + type);
    if (f != null) {
    out.println("length: " + f.length());
    out.println();
    out.println("</PRE>");
    catch (Exception e) {
    out.println("<PRE>");
    out.println("</PRE>");
    out.println("</BODY></HTML>");
    %>

    you have not understood my point
    how does this code will run on servlet when I want to upload a file from client's
    machine to server machine
    what I am doing is I am giving an option to the user that he/she can browse the file and then select any file and finally it's action is post in the jsp form for which I have sent the code
    All the computers are connected in LAN
    So how to upload a file from client's machine to server's machine
    Plz give me a solution

  • Help please to Upload a file from my PC to server's KM

    Hello:
    I can't Upload correctly a file from my local PC to a KM of the server.
    My problem is after that I've uploaded any file from my PC to KM, sometimes when I open or download it from the KM appears blank, and when I try another way to write the file (out.write()) I've uploaded a bad file that can't be downloaded or opened it. I can't get the file Data of the file for uploading, I need to set it with the fileResource (I tried with fileResource.read(false))
    I use a FileUpload in my view.
    <b>My Context:</b>
    File (node)
         |----fileResource  (com.sap.ide.webdynpro.uielementdefinitions.Resource)
         |----fileData  (binary)   
         |----fileName  (String)
    wdDoInit(){
         IPrivateUploadDownloadKMView.IFileElement fileBind = wdContext.createFileElement();
         wdContext.nodeFile().bind(fileBind);
         IWDAttributeInfo attInfo = wdContext.nodeFile().getNodeInfo().getAttribute("fileData");
         ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
    onActionSubir(){
          IPrivateUploadDownloadKMView.IFileElement fileElement = wdContext.currentFileElement();
          IWDResource resource = fileElement.getFileResource();
          fileElement.setFileName(resource.getResourceName());
          fileElement.setFileData(fileData);
          byte[] fileData=new byte[resource.read(false).available()];
          fileElement.setFileData(fileData);
          fileName = fileElement.getFileName();
         try{               
               File file = new File(fileName);
               FileOutputStream out = new FileOutputStream(file);
               out.write(fileElement.getFileData());
               out.close();
               fin = new FileInputStream(fileName);
               fin.read();
               Content content = new Content(fin,null, -1);
                IResource newResource = folder.createResource(fileElement.getFileName(),null, content);
          catch(Exception e){
                 IWDMessageManager mm = wdControllerAPI.getComponent().getMessageManager();
                 mm.reportWarning("error: "+e.getMessage());
    Can you help me?, any sugestions to solve my problem or improve my code?
    Regards
    Jonatan.

    If you have got the permission to access <b>content management</b> in portal appliction server consle,then click on content management >select the KM Repository and clik on it.Then right click on <b>folder</b>>new-->upload.After clicking the upload option one page will be open and then you can browse your local file and upload to the KM Repository.

  • How do I change the default folder that opens when uploading a file to the internet from my mac? (at the moment it automatically defaults to 'Downloads' folder)

    How do I change the default folder that opens when uploading a file to the internet from my mac? (at the moment it automatically defaults to 'Downloads' folder)
    For example...
    I am on a webiste and wish to upload a photo.
    I click on select file on the website
    Finder opens and defaults to 'Downloads' folder (it happens with all wesbites)
    How do I change this?

    I am on a webiste and wish to upload a photo.
    I click on select file on the website
    You are attempting to download the picture to your computer not uploading photo to the website if I am understanding you correctly.
    To change the download direction, you must do so through your browser's Preferences.  If you are using Safari, hopefully, someone who uses Safari will help you and/or post over in their forums.  I do not use Safari.
    If using Firefox>Preferences>General>Save Files to:

  • Error while uploading text file....

    Halo Friends,
    I am uploading 4 text files which contain three columns separated by a tab, but when i am trying to upload those files using WS_UPLOAD Function Module i am getting a runtime error saying 'error while uploading/downloading'.
    Please solve this problem as soon as possible.
    Thanks in Advance,
    rama

    Halo again,
    Now that i am able to upload the files, i need to update the database table the update statement is executing correctly but when i debug i see that the sy-subrc value is 4 but not 0.
    and hence the it is not committed.
    Any suggestions. i am pasting my code here for your reference:
    Tables: qmfe.
    data: begin of gt1_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr20 like qmfe-/itml/usr20,
          end of gt1_qmfe.
    data: begin of gt2_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr21 like qmfe-/itml/usr21,
          end of gt2_qmfe.
    data: begin of gt3_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr19 like qmfe-/itml/usr19,
          end of gt3_qmfe.
    data: begin of gt4_qmfe occurs 0,
          qmnum       like qmfe-qmnum,
          fenum       like qmfe-fenum,
          /itml/usr07 like qmfe-/itml/usr07,
          end of gt4_qmfe.
    data: gs1_qmfe like line of gt1_qmfe,
          gs2_qmfe like line of gt2_qmfe,
          gs3_qmfe like line of gt3_qmfe,
          gs4_qmfe like line of gt4_qmfe.
    data: ls_lines1 type i,
          ls_lines2 type i,
          ls_lines3 type i,
          ls_lines4 type i.
    parameters: ip_file1 type RLGRAP-FILENAME default 'C:\Urgent\TextFiles\StoDt.txt'     obligatory,
                ip_file2 type RLGRAP-FILENAME default 'C:\Urgent\TextFiles\RcDtCust.txt'  obligatory,
                ip_file3 type RLGRAP-FILENAME default 'C:\Urgent\TextFiles\DockDate.txt'  obligatory,
                ip_file4 type RLGRAP-FILENAME default 'C:\Urgent\TextFiles\AWB.txt'       obligatory.
    field-symbols: <fs1> like gs1_qmfe,
                   <fs2> like gs2_qmfe,
                   <fs3> like gs3_qmfe,
                   <fs4> like gs4_qmfe.
    perform upload_gt1_qmfe.
    perform upload_gt2_qmfe.
    perform upload_gt3_qmfe.
    perform upload_gt4_qmfe.
    perform update_qmfe.
    *&      Form  upload_gt1_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt1_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file1
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt1_qmfe.
    describe table gt1_qmfe lines ls_lines1.
    write: / ls_lines1.
    ENDFORM.                    " upload_gt1_qmfe
    *&      Form  upload_gt2_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt2_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file2
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt2_qmfe.
    describe table gt2_qmfe lines ls_lines2.
    write: / ls_lines2.
    ENDFORM.                    " upload_gt2_qmfe
    *&      Form  upload_gt3_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt3_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file3
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt3_qmfe.
    describe table gt3_qmfe lines ls_lines3.
    write: / ls_lines3.
    ENDFORM.                    " upload_gt3_qmfe
    *&      Form  upload_gt4_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM upload_gt4_qmfe .
    CALL FUNCTION 'WS_UPLOAD'
    EXPORTING
       FILENAME                      = ip_file4
       FILETYPE                      = 'DAT'
      TABLES
        DATA_TAB                      = gt4_qmfe.
    describe table gt4_qmfe lines ls_lines4.
    write: / ls_lines4.
    ENDFORM.                    " upload_gt4_qmfe
    *&      Form  update_qmfe
          text
    -->  p1        text
    <--  p2        text
    FORM update_qmfe .
    data ls_cnt type i.
    loop at gt1_qmfe assigning <fs1>.
    update qmfe set    /itml/usr20 = <fs1>-/itml/usr20
                where  qmnum       = <fs1>-qmnum
                and    fenum       = <fs1>-fenum.
    if sy-subrc = 0.
    commit work.
    add 1 to ls_cnt.
    endif.
    endloop.
    write: / ls_cnt.
    ENDFORM.                    " update_qmfe

  • Error while uploading par file

    Hi,
            I am trying to  upload par file for the first time. When I try to deploy the par file, I am getting message saying, 'Operation failed: Please make surethe server 'Myportal' (host:port) is running or check the log( sap-plugin.log) for more details'/
    I have tried to open the portal  http://host:port/irj/portal. I am able to open the portal and can login successfully also. This means that the portal is running ( Am I right ?).
    I have tried to  upload the par file directly from the portal using
    system admin>support>portal runtime>Administration console--Archive uploader.
    I got the error messages as given below.
    INFO: Detected Portal Archive File: HelloProject.par
    INFO: Deployment failed - exception caught: Application upload failed: HelloProject.par - more detail at: E:\usr\sap\IN1\JC01\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\deployment\pcd\HelloProject.par.log
    Please guide me about what could be the pbm and  how to solve this.
    Thanks in advance.
    Regards,
    Vishnu Priya

    Hi Vishnu,
    Are you trying to upload a PAR file from the NWDS?
    if then you need to configure the J2EE engine correctly before doing so
    for that matter you need  the port number and also have that the SDM password for deployement
    Once these are ready ...go to the J2EE engine tab available on the bottom corner.And make sure the J2EE engine is working. or the server is up.Is this what you are looking for.....if yes.....just reply...I can continue with the deployment..
    Regards
    Arun

  • Error While Uploading, hidden file somewhere conflicting?

    I was in the process of uploading some files to Acrobat.com, most worked but a couple of them failed. The progress bar in the upper right disappeared, but my files weren't showing. Figured there was just a problem with the file, so I tried to upload again, one at a time. It uploaded and then said a file exists with that name already and do I want to delete new, delete previous or rename the new one. I say to delete the one that was previously uploaded, and my file now appears with a " (1)" added to the file name. When I try to rename it to the correct name the error it gives is: "Could not complete your request (400) - An error occurred while trying to complete your request, and it could not be completed."
    Is there a way to see hidden files or files that errored so I can clear them out to start fresh?

    I was thinking the same thing, hoping there was some hidden way to get at the files.
    I tried going through incognito mode and through a separate browser that had never been to any Adobe site, same error when I tried to rename.
    I think I'll try to move the files I know are good to another folder then delete the folder where these annoying files are hidden. I would think that would get rid of them then I can start over. I'll let you know.

Maybe you are looking for