How to upload and download files using FTP to a server(webserver) in JSP

I have to upload and download multiple files Of(size >5 MB)using FTP to a
Server(webserver) in JSP
how to do that ?

Or he could create his own tag libraries, no? :)One supposes that, technically, one could create a taglib wrapper around an existing FTP library. There might be licensing issues with distributing that taglib wrapper.
Of course, one could find the FTP RFC online, read it, and implement one's own FTP client implementation, complete with a tag library access point.

Similar Messages

  • Minimum version required to upload and download files using Netweaver Gateway

    What is the minimum service pack required to use the feature of Upload and download files using netweaver gateway. I already have a SP05

    Hi,
    as per this blog How to Read Photo from SAP system using SAP Gateway this should be possible with SP05.
    also refer How To Upload and Download Files Using SAP NW Gateway SP06
    Regards,
    Chandra

  • How to Upload and Download Files

    Dear Friends
    I want to write code for Upload and Download file ( Group of Files). Please Guide me the right way I have a few java files and i have compiled that but i donot know how to run that file and i am stranger to java also.
    Please send me reply and sugessest me.
    my email id is [email protected]
    Amogh

    I have write a upload code, but the code can deal with txt onle, it can not deal with bmp or doc, what the matter?
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class Upload extends HttpServlet {
         String rootPath;
         static final int MAX_SIZE = 102400;
         public void init(ServletConfig config) throws ServletException
              super.init(config);
         public void doGet(HttpServletRequest request,HttpServletResponse response)
         throws ServletException,IOException
              response.setContentType("text/html");
              PrintWriter out = new PrintWriter (response.getOutputStream());
              out.println("<html>");
              out.println("<head><title>Servlet1</title></head>");
              out.println("<body><form ENCTYPE=\'multipart/form-data\' method=post action=''><input type=file enctype=\'multipart/form-data\' name=filedata>");
              out.println("<input type=submit></form>");
              out.println("</body></html>");
              out.close();
         public void doPost(HttpServletRequest request,HttpServletResponse response)
              ServletOutputStream out=null;
              DataInputStream in=null;
              FileOutputStream fileOut=null;
              rootPath = "C:\\upload\\tmp\\";          //The directory to save the target file.
              try
                   response.setContentType("text/plain");
                   out = response.getOutputStream();
              catch (IOException e)
                   System.out.println("Error getting output stream.");
                   System.out.println("Error description: " + e);
                   return;
         try
              String contentType = request.getContentType();
              if(contentType != null && contentType.indexOf("multipart/form-data") != -1)
                   in = new DataInputStream(request.getInputStream());
                   int formDataLength = request.getContentLength();
                   byte dataBytes[] = new byte[formDataLength];
                   int bytesRead = 0;
                   int totalBytesRead = 0;
                   int sizeCheck = 0;
                   String sourceFileName = "";
                   String targetFileName = "";
                   while (totalBytesRead < formDataLength)
                        sizeCheck = totalBytesRead + in.available();
                        if (sizeCheck > MAX_SIZE)
                             out.println("Sorry, file is too large to upload.");
                             return;
                        bytesRead = in.read(dataBytes, totalBytesRead, formDataLength);
                        totalBytesRead += bytesRead;
                   String file = new String(dataBytes);
                   dataBytes = null;
                   int lastIndex = contentType.lastIndexOf("=");
                   String boundary = contentType.substring(lastIndex+1, contentType.length());
                   //File Content
                   //out.println("File content: " + file);
                   if (file.indexOf("name=") > 0)
                        int fileNameStart = 0;
                        int fileNameEnd = 0;
                        fileNameStart = file.indexOf("filename=\"");
                        fileNameEnd = file.indexOf("Content-Type:");
                        sourceFileName = file.substring(fileNameStart + 10, fileNameEnd - 3);
                        //Source File
                        out.println("Source file: " + sourceFileName);
                   String successPage="";
                   if (file.indexOf("name=\"SuccessPage\"") > 0)
                        successPage = file.substring(file.indexOf("name=\"SuccessPage\""));
                        successPage = successPage.substring(successPage.indexOf("\n")+1);
                        successPage = successPage.substring(successPage.indexOf("\n")+1);
                        successPage = successPage.substring(0,successPage.indexOf("\n")-1);}
                        String overWrite;
                        if (file.indexOf("name=\"OverWrite\"") > 0)
                             overWrite = file.substring(file.indexOf("name=\"OverWrite\""));
                             overWrite = overWrite.substring(
                             overWrite.indexOf("\n")+1);
                             overWrite = overWrite.substring(overWrite.indexOf("\n")+1);
                             overWrite = overWrite.substring(0,overWrite.indexOf("\n")-1);
                        else
                             overWrite = "false";
                        String overWritePage="";
                        if (file.indexOf("name=\"OverWritePage\"") > 0)
                             overWritePage = file.substring(file.indexOf("name=\"OverWritePage\""));
                             overWritePage = overWritePage.substring(overWritePage.indexOf("\n")+1);
                             overWritePage = overWritePage.substring(overWritePage.indexOf("\n")+1);
                             overWritePage = overWritePage.substring(0,overWritePage.indexOf("\n")-1);
                        targetFileName = sourceFileName.substring(sourceFileName.lastIndexOf("\\") + 1);
                        targetFileName = rootPath + targetFileName;
                        //Target File:
                        out.println("Target file: " + targetFileName);
                        int pos; //position in upload file
                        pos = file.indexOf("filename=");
                        pos = file.indexOf("\n",pos)+1;
                        pos = file.indexOf("\n",pos)+1;
                        pos = file.indexOf("\n",pos)+1;
                        int boundaryLocation = file.indexOf(boundary,pos)-4;
                        file = file.substring(pos,boundaryLocation);
                        File checkFile = new File(targetFileName);
                        if (checkFile.exists())
                             if (!overWrite.toLowerCase().equals("true"))
                                  if (overWritePage.equals(""))
                                       out.println("Sorry, file already exists.");
                                  else
                                       //redirect client to OverWrite HTML page
                                       response.sendRedirect(overWritePage);
                                  return;
                        File fileDir = new File(rootPath);
                        if (!fileDir.exists())
                             fileDir.mkdirs();
                        fileOut = new FileOutputStream(targetFileName);
                        fileOut.write(file.getBytes(),0,file.length());
                        if (successPage.equals(""))
                             out.println("File written to: " + targetFileName);
                        else
                             response.sendRedirect(successPage);
                        else //request is not multipart/form-data
                             out.println("Request not multipart/form-data.");
                   catch(Exception e)
                        try
                             System.out.println("Error in doPost: " + e);
                             out.println("An unexpected error has occurred.");
                             out.println("Error description: " + e);
                        catch (Exception f) {}
                   finally
                   try
                        fileOut.close(); //close file output stream
                   catch (Exception f) {}
                   try
                        in.close(); //close input stream from client
                   catch (Exception f) {}
                   try
                        out.close(); //close output stream to client
                   catch (Exception f) {}
    }

  • How to upload and download files and images using ibm db2?

    For my project i need to upload tutorials in pdf files and doc files to db2 and need to display them in jsp page.and also i need to insert images into db2.Please help me if u kno any of these.
    Thanks in advance.

    UsthadThegreat wrote:
    For my project i need to upload tutorials in pdf files and doc files to db2 and need to display them in jsp page.and also i need to insert images into db2.Please help me if u kno any of these.
    Thanks in advance.You know one of the most key elements of getting help in programming is to post sections of code, or preferably, working examples and then ask specific questions on things you would like to improve, don't understand, or just doesn't work.
    Without some displayed effort on your part, you are going to be fairly hard pressed to get any type of help.

  • Upload and Download file using MySQL database.

    Can anyone help me ....
    how to write a code to upload file to and retrieve file from MySQL database.
    The files may be .bmp , .wav, .zip, .exe and so on....
    thank you...

    Cross-posted and multi-posted.

  • Does anyone know how to upload and download files to the icloud storage?

    Well, it says i have 5g of free storage... but what good is it?  There doesn't seem to be any way to put anything there.
    What am I missing here?

    iCloud does not have a general file syncing service, like Dropbox or Sugarsync.  Only certain types of files can be synced and only by applications/apps that specifically support these files and that support iCloud.  For example, Pages can sync to iCloud and only Pages apps on devices can access these files.  Within DocsToGo, nothing can be synced to iCloud.

  • Upload and Download Files in an Application

    hi,
    I'm use Application Express 2.1.0.00.39 and the procedure " How to Upload and Download Files in an Application" :
    http://download-west.oracle.com/docs/html/B16376_01/up_dn_files.htm#sthref177
    I do not find the following tables or view:
    HTMLDB_APPLICATION_FILES or wwv_flow_file_objects$.
    which it is my error?
    thanks.
    Luigi

    The documentation was for version 2.2. I could not find a 2.0 version of this howto:
    http://download-west.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/up_dn_files.htm#CIHCFCHF
    However, I did find the correct name of the view for my version, HTMLDB_APPLICATION_FILES
    After following the instructions in the above-mentioned "how to" (uploading and downloading files), I am a getting a html 403 error (You are not authorized to view this page) when I try to download from my custom table using the procedure specified in the howto.
    I've granted execute on the procedure to public only (as specified in the doco).
    err nvm. This has already been answered,
    http://download-west.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25309/adm_wrkspc.htm#BEJCGJFJ.
    Message was edited by:
    user507810

  • How to upload and download any file from plsql through weblogic server

    hi all,
    how to upload and download any file from plsql through weblogic server? i am using oracle 10g express edition and jboss.
    Thanks and Regards,
    MSORA

    hi bala ,
    for a windown server u can use VNC (virtual network connection) which opens a session on u r desktop later u can drag and drop form there vice versa and for a linux box you can use Win SCP which helps to open a session with interface to u r desktop in both cases you can upload and down load files very easiy just as we drag and drop items in a simple pc .. we use the same technique...
    bye
    vamshi

  • How to upload  and download a files into AL11 directory in ABAP

    Hi,
                   How to upload  and download a files into AL11 directory in ABAP
    thanks
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 21, 2011 9:18 AM

    You should try one of these forums for an answer to your question:
    http://swforum.sun.com/jive/forum.jspa?forumID=116
    http://community.java.net/netbeans
    http://linux.java.net

  • How can I upload and download files with uiXML?

    I want to implement upload and download files with uiXML. In some previouse topic I got answare to look in AbstractPageBroker class in JavaDOC. I did it but this is a very-very little resolution description for this problem. I think for developers YOU (UIX Team) must in very quick time to put some examples on the NET because this is a nice technology but with adecvate samplase and developers guide it will be dead very soon. I digging this forum for information. I see many many people have same problems about this technology. They like it and want to use and try but documentation is very very poor.
    WE WANT EXAMPLES and separate forum for UIX. I think it deserve this.
    If You have any more detailed documentation would be nice to put on the net. I have uixdemo.zip file but this is in very early fase of development. I downloaded it before fwe months. And now I can't find it anymore on youre site. What happend?

    Attila -
    I went back and re-read the JavaDoc for AbstractPageBroker and MultipartFormItem and put together the following sample PageBroker based on the description from the JavaDoc:
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import oracle.cabo.servlet.BajaContext;
    import oracle.cabo.servlet.Page;
    import oracle.cabo.share.util.MultipartFormItem;
    import oracle.cabo.servlet.xml.UIXPageBroker;
    * An extension of UIXPageBroker which stores all uploaded
    * files in the temporary directory.
    public class UploadingPageBroker extends UIXPageBroker
    * Override of AbstractPageBroker.doUploadFile() which saves
    * all files to the temporary directory.
    protected String doUploadFile(
    BajaContext context,
    Page page,
    MultipartFormItem item) throws IOException
    // Get the location of the file to create in the temp directory.
    // Of course a real application probably wouldn't upload files to
    // the temp directory - just using this contrived example to
    // demonstrate basic uploading support.
    File file = _getFile(context, item);
    if (file != null)
    // Create a FileOutputStream. Of course, a real application would
    // probably want to buffer the output
    FileOutputStream out = new FileOutputStream(file);
    // Write out the file
    item.writeFile(out);
    // Close up the output stream
    out.close();
    // We can return a value here to add to the PageEvent
    // if so desired.
    return null;
    // Gets the File for the item that we are uploading
    private File _getFile(
    BajaContext context,
    MultipartFormItem item
    // Get the file name
    String name = item.getFilename();
    // If we don't have a file, bail...
    if (name == null)
    return null;
    // Get the path to the temporary directory
    File dir = _getTempDir();
    // Return the File object
    return new File(dir, name);
    // Returns the path to the temprary directory
    private File _getTempDir()
    // Get the temporary directory from the ServletContext
    ServletConfig sConfig = getServlet().getServletConfig();
    ServletContext sContext = sConfig.getServletContext();
    return (File)sContext.getAttribute("javax.servlet.context.tempdir");
    In this sample, each uploaded file is simply saved in the temporary directory. You'll want to replace the code that creates the FileOutputStream for the uploaded file to use whatever OutputStream makes sense for your application.
    BTW - I used the following UIX page to test this out:
    <?xml version="1.0" encoding="UTF-8"?>
    <page xmlns="http://xmlns.oracle.com/uix/controller">
    <content>
    <pageLayout xmlns="http://xmlns.oracle.com/uix/ui">
    <contents>
    <form name="uploadForm" usesUpload="true">
    <contents>
    <fileUpload name="uploadedFile"/>
    <submitButton name="upload" text="Upload"/>
    </contents>
    </form>
    </contents>
    </pageLayout>
    </content>
    </page>
    Hope this sample helps with the uploading part of your question. I'll see if I can provide a download sample in a later post.

  • Uploading and downloading files from a web app (Urgent!!)

    Hi everyone:
    I'm developing an application in PL/SQL to upload and download files from an HTML webpage. I congured the document table and the parameters necessary in the DAD of my application.
    when I upload the file using my webpage that file info is automatically uploaded to the doc table. This is as far as I have gotten.
    I need to do the following:
    - Place the uploaded file into a column in another table in my database as part of a text message (think of it as an email message), and delete the file from the doc table (as this is thought to be a temp table that holds the file when uploaded from my webpage)
    - Retreive the file so that it can be downloaded from another web page.
    The file can be a PDF, WORD DOC, etc...
    I now that I can do this with InterMedia but I haven't figured out how :(
    Can anyone please point me to an example or some documentation that can guide me through the process.
    DB VERSION: 8.1.7
    IAS VERSION: 1.0.2.2
    Thanks,
    Carlos Abarca

    The idea was for you to look at the code and get an idea of how to access the BLOB in the document table. IF you look at the procedure
    insert_new_photo( new_description IN VARCHAR2,
    new_location IN VARCHAR,
    new_photo IN VARCHAR2 )
    It shows how to access the blob that is stored in the document table. You can then copy this blob to your own table using the DBMS_LOB package.
    Hope this helps,
    Larry

  • How to upload and download in BLOB?

    I tried webutil but is not working properly according to my needs is there any other way to upload and download files in BLOB?
    If any body knows solution please tell me.
    Regards,

    Dear Colleague,
    In my Forms application, I use the WEBUTIL to load files into a BLOB column. However, prior to getting WEBUTIL to work, I loaded files into the BLOB column using the following PL/SQL code.
    Note, that the example assumes that the row already exists in the table and you are updating it by loading the file into the BLOB. You will also be required to first create a Database Directory object (in my case, it was called "RKMS_DOC_DIR")
    I do not have an example for downloading, as I use the WEBUTIL functionality for this.
    Good luck!
    Randy
    PL/SQL (DBMS_LOB Package): Loading an Internal Persistent BLOB
    with BFILE Data
    The following example illustrates:
    How to use LOADBLOBFROMFILE to load the entire file without getting its length first.
    How to use the return value of the offsets to calculate the actual amount loaded.
    DECLARE
    src_loc BFILE := bfilename('RKMS_DOC_DIR','ROPE_Offerte_v2.pdf') ;
    v_author VARCHAR2(10) := 'RKMS_MGR' ;
    dst_loc BLOB;
    src_offset NUMBER := 1;
    dst_offset NUMBER := 1;
    src_osin NUMBER;
    dst_osin NUMBER;
    bytes_rd NUMBER;
    bytes_wt NUMBER;
    BEGIN
    -- SELECT ad_composite INTO dst_loc FROM Print_media
    -- WHERE product_id=3106 and ad_id=13001 FOR UPDATE;
    SELECT doc INTO dst_loc FROM docs
    WHERE USER_AUTHOR_ID = v_author FOR UPDATE;
    /* Opening the source BFILE is mandatory */
    dbms_lob.fileopen(src_loc, dbms_lob.file_readonly);
    /* Opening the LOB is optional */
    dbms_lob.OPEN(dst_loc, dbms_lob.lob_readwrite);
    /* Save the input source/destination offsets */
    src_osin := src_offset;
    dst_osin := dst_offset;
    /* Use LOBMAXSIZE to indicate loading the entire BFILE */
    dbms_lob.LOADBLOBFROMFILE(dst_loc, src_loc, dbms_lob.lobmaxsize, src_offset, dst_offset) ;
    /* Closing the LOB is mandatory if you have opened it */
    dbms_lob.close(dst_loc);
    dbms_lob.filecloseall();
    COMMIT;
    /* Use the src_offset returned to calculate the actual amount read from the BFILE */
    bytes_rd := src_offset - src_osin;
    dbms_output.put_line(' Number of bytes read from the BFILE ' || bytes_rd ) ;
    /* Use the dst_offset returned to calculate the actual amount written to the BLOB */
    bytes_wt := dst_offset - dst_osin;
    dbms_output.put_line(' Number of bytes written to the BLOB ' || bytes_wt ) ;
    /* If there is no exception the number of bytes read should equal to the number of bytes written */
    END ;
    /

  • Uploading and Downloading files in an Applicaiton

    I was able to successfully upload and download files stored in the database through Application Express by following the how to instructions at -->
    http://download-uk.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/up_dn_files.htm#CJAHDJDA
    QUESTION: Is it possible to retrieve the downloaded file without granting execute to the download procedure? My DBA is requesting that I remove the procedures public grant, but when I do, I can no longer download the file.

    As long as the Oracle username with the connection has 'execute' on the package 'public' should not need execute. Though I do not use the tools in question so there may be factors I am unaware of, but Oracle wise the connected session needs execute. If can get it from public, a role, or a direct grant. I just say use role based grants or direct grants rather than a public grant to get the privilege.
    HTH -- Mark D Powell --

  • How to upload an excel file using ABAP.

    Hi,
    Can anyone please help me in understanding how to upload an excel file using ABAP.
    Thanks!!

    http://diocio.wordpress.com/2007/02/12/sap-upload-excel-document-into-internal-table/
    check the link
    TYPES: Begin of t_record,
    name1 like itab-value,
    name2 like itab-value,
    age   like itab-value,
    End of t_record.
    DATA: it_record type standard table of t_record initial size 0,
    wa_record type t_record.
    DATA: gd_currentrow type i.
    *Selection Screen Declaration
    PARAMETER p_infile like rlgrap-filename.
    *START OF SELECTION
    call function ‘ALSM_EXCEL_TO_INTERNAL_TABLE’
    exporting
    filename                = p_infile
    i_begin_col             = ‘1&#8242;
    i_begin_row             = ‘2&#8242;  “Do not require headings
    i_end_col               = ‘14&#8242;
    i_end_row               = ‘31&#8242;
    tables
    intern                  = itab
    exceptions
    inconsistent_parameters = 1
    upload_ole              = 2
    others                  = 3.
    if sy-subrc <> 0.
    message e010(zz) with text-001. “Problem uploading Excel Spreadsheet
    endif.
    Sort table by rows and colums
    sort itab by row col.
    Get first row retrieved
    read table itab index 1.
    Set first row retrieved to current row
    gd_currentrow = itab-row.
    loop at itab.
      Reset values for next row
    if itab-row ne gd_currentrow.
    append wa_record to it_record.
    clear wa_record.
    gd_currentrow = itab-row.
    endif.
    case itab-col.
    when ‘0001&#8242;.                              “First name
    wa_record-name1 = itab-value.
    when ‘0002&#8242;.                              “Surname
    wa_record-name2 = itab-value.
    when ‘0003&#8242;.                              “Age
    wa_record-age   = itab-value.
    endcase.
    endloop.
    append wa_record to it_record.
    *!! Excel data is now contained within the internal table IT_RECORD
    Display report data for illustration purposes
    loop at it_record into wa_record.
    write:/     sy-vline,
    (10) wa_record-name1, sy-vline,
    (10) wa_record-name2, sy-vline,
    (10) wa_record-age, sy-vline.
    endloop.

  • Uploading and downloading files in webdynpro java

    how to upload and download xl files in webdynpro java application .

    Hi ,
    Refer these links they maybe helpful to you
    You can check this sampple example from SDN
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40db4a53-41a9-2910-d4a2-9c28283f6658
    Uploading and Downloading Files In Web Dynpro Java
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a4d71
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f
    http://help.sap.com/saphelp_nw04/helpdata/en/43/85b27dc9af2679e10000000a1553f7/content.htm
    Uploading and Downloading Files In Web Dynpro Tables
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0e10426-77ca-2910-7eb5-d7d8982cb83f
    Some more links regarding Uploading and DownLoading Files
    Uploading and downloading files
    Upload and Download file through RFC called by java
    Regards,
    Saleem

Maybe you are looking for