473,320 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to upload multiple files using java

hello

i am in need to upload multiple files. help me.......
Mar 3 '08 #1
2 3755
gaya3
184 100+
hello

i am in need to upload multiple files. help me.......

Hi,
For uploading multiple files.. u may use scanners..
I have tried out one sample example wit that,it works fine..

import java.io.*;
import java.util.*;
class MultipleFiles{
public static void main(String args[]){
System.out.println("Enter the number of files to upload::::::::::");
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
System.out.println("Enter the file names to upload::::::::::");
try{
for(int j=0;j<i;j++) {
String fileName = (String)sc.next();
File file = new File(fileName);
FileReader reader = new FileReader(file);
BufferedReader buff = new BufferedReader(reader);
String str = null;
StringBuffer strBuff = new StringBuffer();
while( (str=buff.readLine()) != null){
strBuff.append(str);
}
System.out.println("Uploaded File contents::::::::::::::: : "+strBuff);
}}
catch(Exception e){
e.printStackTrace();
}}}

Am i undersatnding ur query in rt way?

-Thanks
Hamsa
Mar 3 '08 #2
r035198x
13,262 8TB
Hi,
For uploading multiple files.. u may use scanners..
I have tried out one sample example wit that,it works fine..

import java.io.*;
import java.util.*;
class MultipleFiles{
public static void main(String args[]){
System.out.println("Enter the number of files to upload::::::::::");
Scanner sc = new Scanner(System.in);
int i = sc.nextInt();
System.out.println("Enter the file names to upload::::::::::");
try{
for(int j=0;j<i;j++) {
String fileName = (String)sc.next();
File file = new File(fileName);
FileReader reader = new FileReader(file);
BufferedReader buff = new BufferedReader(reader);
String str = null;
StringBuffer strBuff = new StringBuffer();
while( (str=buff.readLine()) != null){
strBuff.append(str);
}
System.out.println("Uploaded File contents::::::::::::::: : "+strBuff);
}}
catch(Exception e){
e.printStackTrace();
}}}

Am i undersatnding ur query in rt way?

-Thanks
Hamsa
1.) Use code tags when posting code
@OP Upload from where to where?
Mar 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dustin | last post by:
I'm looking for a PHP script that supports multi-file upload. However, because my users could potentially be uploading hundreds of files, the existing multi-file upload scripts that people have...
1
by: Chris Mosser | last post by:
I'm looking for an applet that allows for multiple file uploads. I found jupload and am considering using that, but I might have a couple issues. I need to build a web app for a print shop, that...
6
by: x. zhang | last post by:
Hi Guys, We know that we can use <input type=file ...> to upload one file per time to the server. My question is if there are some way to upload multiple files per time to the server. (Of...
3
by: JFB | last post by:
Hi All, It's a way to upload multiple files on a web site using vb.net 2005? I see the uploadFile tool, but it's only for one file. Any ideas, examples, links??? Tks in advance JFB
7
by: crowl | last post by:
Hi there, I am looking for a component allowing me uploading multiple files by my asp page. I have found several components achieving this by require a <input type="file" name="FileX"> field for...
4
by: leen | last post by:
how to upload the multiple files with using one browser show the multiple files in the same page???plz help me..
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
43
by: bonneylake | last post by:
Hey Everyone, Well this is my first time asking a question on here so please forgive me if i post my question in the wrong section. What i am trying to do is upload multiple files like gmail...
4
by: MoroccoIT | last post by:
Greetings - I saw somewhat similar code (pls see link below) that does mupltiple files upload. It works fine, but I wanted to populate the database with the same files that are uploaded to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.