Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Multiple File(s) Upload via SFTP Server

2821240Nov 13 2015 — edited Nov 17 2015

Hi Team,

I have a requirement where i have to create a screen to allow user to upload pdf file(s) and there is a upload button beside file upload which will get enable once a file is uploaded; on click of upload button we will show him in a table containing collection of documents uploaded but not inserted in db for this i am creating a row in vo with file details like filename and content type.


I am able to to do the same one by one on click of upload button and sftp the same to server, verified it is having file size but i don't want to upload one by one because there are chances that user may roll back everything or he may close browser or whatever; even i have to establish connection every time a file is uploaded.


What i have done is i have created a class with inputstream and string variables.

Sample

public class MultipleFilesHolder implements Serializable {

    public MultipleFilesHolder() {

        super();

    }

    private  InputStream inputStream;

    private String fileName;

    private static final long serialVersionUID = 98599739738L;

with getter and setter

Every time i press a upload button i am creating an object in MultipleFilesHolder  for setting details.

Now on commit button, i am calling my sftp and uploading all files one by one.

Problem is when i check in my server files are getting generated with 0 bytes.

Please share your feedback/opinions if there is a better approach of doing it or am i missing somewhere.

I don't wish to use temp location to hold files for intermediate usage and transfer on commit call.


My Jdev version is 11.1.2.4.0.

Thanks.

This post has been answered by 2821240 on Nov 17 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2015
Added on Nov 13 2015
1 comment
547 views