[ 
https://issues.apache.org/jira/browse/IO-169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741750#action_12741750
 ] 

François LEIBER commented on IO-169:
------------------------------------

Something like this:

        /**
         * {...@link FileUtils#copyURLToFile(URL, File)} but the types the 
other way around to upload a file to FTP.
         */
        public static void copyFileToURL(File source, URL destination) throws 
IOException {
                FileInputStream input = new FileInputStream(source);
                
                try {
                        OutputStream output = 
destination.openConnection().getOutputStream();

                        try {
                                IOUtils.copy(input, output);
                        } finally {
                                IOUtils.closeQuietly(output);
                        }
                } finally {
                        IOUtils.closeQuietly(input);
                }
        }


> FileUtils.copyFileToURL
> -----------------------
>
>                 Key: IO-169
>                 URL: https://issues.apache.org/jira/browse/IO-169
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Stephane Demurget
>            Priority: Trivial
>             Fix For: 2.x
>
>
> FileUtils contains the very useful FileUtils.copyURLToFile. It would makes 
> sense to do it the other around too, or rename them download vs. upload and 
> deprecate the old one. I can provide a quick patch if needed, but this is 
> trivial.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to