How can i download many file from server one times.

Hi,
I want to create the service to download multi-files from web server one time
from browser. It seems no way to do it. My soulition is compressing the files
to zip before download it. The problem is that when the user uncompresses the
files,full path of downloaded files are setted. Look like this:
/usr/tmp/test/file1
/usr/tmp/test/file2
/usr/tmp/test/file3
My question is :
1. Is there any way not to specify the full path of a file when
add the file to zip.
Here is the source
BufferedInputStream bis
= new BufferedInputStream(
new FileInputStream( file ) );
//if not full path . can is works?????
ZipEntry target = new ZipEntry( file.getPath() );
// zos is ZipOutputStream
zos.putNextEntry( target );
int c;
while( ( c = bis.read() ) != EOF ) {
zos.write( (byte)c );
2. Is there any way to get and change the current work directory of my server ?
Please help!!

If i use file.getName(). I will lost the struct of path.
I means that,if i compress the list of files:
/usr/tmp/test1/file1
/usr/tmp/test1/file2
/usr/tmp/test2/file3
can i keep the part of path's strcut. (usr/tmp/../.. etc.)
I tried to do as this:
target = new ZipEntry( file.getPath.substring(1));
an error be reported when uncompressed the zip file.
error message:
warning [zt000002.zip]: extra 28 bytes at beginning or within Zip file (attempting to process anyway)
Error in file #1: bad Zip file offset (Error local header signature not found): 0
(attempting to re-compensate)
Extracting 20030109.xls
Error: unexpected end of file encountered
Error: invalid compressed data to inflate
Why? can i set "any" entry name??

Similar Messages

  • How can i download to iphone from another one of my computers itunes?

    I just put itunes on my work PC. how can i download stuff to my iphone? I have my iphone connected to my work PC and it wont let my drag tracks to my iphone.

    You don't. The iPhone can only sync media with ONE computer. If you try to sync with another, it will first erase media already on it.

  • How can I rename many files at the same time?

    Hello!
    I have a bunch of PDF files (2 thousand at least) that I need to transfer to another Mac but since it's running OS 9.2 it won't accept the files because the names are too long, therefore, I need a quick way to change all such files into a shorter name but maintaining some of the serial numbers each file name has (i.e., not changing all to the same name but just taking off the first or last 5 characters for example), is there a way to do this sort of thing with OS 10.3.9 or 10.5.2?
    Best!
    Danny

    Look at this shareware. http://www.jonn8.com/ntf/ It's a batch renaming app, but I'm not sure it will do exactly what you want. However, it does have a 7 day free trial.
    If you do a Google serach using +batch file rename mac+ you can review a lot more apps.
     Cheers, Tom

  • How to download a file from server machine to client machine using jsp

    Hi,
    In my application, I have an excel file stored on my server machine. How can I download that excel file on to my client machine using jsp. Is there any other way I can open that file from my machine and save it in my machine using jsp/java?
    Its an emergency for me to do this.
    Can anyone provide me the full code to download a file from server machine as I don't have
    time to browse through various sites.
    thanks in advance,
    Tiijnar

    Please post your code using code tags (click on CODE above the text area, when posting)
    response.setContentType("application/octet-stream");Why octet-stream? Set the correct mime-type.
    String disHeader = "Attachment; Filename=\"filename\"";The filename should just be the file's name. Not the complete path to the file! This will tell anyone where the file is located on the server. It's also inconvenient because by default,the browser will suggest it as the name for the download.
    Your way of writing to the output stream is just plain wrong. See this snippet (picked from [http://balusc.blogspot.com/2007/07/fileservlet.html])
            BufferedInputStream input = null;
            BufferedOutputStream output = null;
            try {
                // Open streams.
                input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE);
                output = new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
                // Write file contents to response.
                byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
                int length;
                while ((length = input.read(buffer)) > 0) {
                    output.write(buffer, 0, length);
                // Finalize task.
                output.flush();
            } finally {
                // Gently close streams.
                close(output);
                close(input);
            }

  • How to download a file from server?

    Hi everyone,
    I need to download a file from my server to client machine. I got a sample code from ur forum and I modified it slightly.
    //Snippet of code:
    public void doGet(HttpServletRequest req, HttpServletResponse res)throws
         ServletException, IOException{
    int bytesRead=0;
         int count=0;
         byte[] b1=new byte[1];
         //OutputStream out=res.getOutputStream();
         res.setContentType("application/html");
         //Create an input stream from file URL.
         String fileURL="http://localhost:8080/webapps/upload/upload.html";
         BufferedInputStream bis=null;
         BufferedOutputStream bos=null;
         boolean download=false;
         res.setHeader("Content-disposition", "attachment; filename=upload.html " );
         try{
         URL url=new URL(fileURL);
         URLConnection connection=url.openConnection();
         InputStream in=connection.getInputStream();
         bis=new BufferedInputStream(in);
         FileOutputStream fileout=new FileOutputStream("upload.html");
         bos=new BufferedOutputStream(fileout);
         while(-1 != (bytesRead = bis.read())){
         try{
         bos.write(bytesRead);
         bos.flush();
         }//end of try forwhile loop
         catch(SocketException e){
         setError(e);
         break;
    The code is getting compiled, when I run the appln using the URL,
    http://localhost:8080/upload/servlet/DownloadFile
    it opens a pop up dialog box, asking whether to "open", "save" or "cancel" buttons. When I try to open a file, I'm getting a blank page.
    I'm not getting the contents of the file.
    So pls can anyone tel me wht's wrong in the code or do i need to add few more lines in my code?
    Also pls let me know, how can I download any files of type .doc, html, .txt, .zip, or any type, without mentioning the file type?
    Thanks in advance

    Do not use a FileOutputStream (that will save it locally to the server). Call HttpServletResponse.getOutputStream(), which will send it back to the browser. Also remember to call close() on the stream at the end.
    - Saish

  • Applet question, how to download resource files from server

    hi,
    i am new at applet world.
    i have an applet that reads some resource, data and configuration files. so i need to download these files from server to client. i did some resarch and could not find how to download files from server in an applet application.
    how can i do this task?
    thank you for your answers.

    You may want to distinguish between 'resources' and data/configuration files.
    'Resources' are non-class files that are part of your application, i.e without them the application would simply not work, just like class files.
    Those are typically images, sounds or resource bundles (GUI elements translated to different languages) that nobody except you, the developer, would touch (when releasing an upgrade or a patch).
    Those should just go into the applet jar or additional jars named in the applet tag.
    Data/configuration files, that may be changed by others than the developers, should be made available through HTTP, just like the applet jar itself. The applet will have (read) access to them using java.net.URLConnection.

  • HT1391 How does one delete apps or files from iCloud Permanently so I may re-download without retrieving existing cloud file?for example the U2 Marketing fast , an Album I have no interest in...is now in my Cloud.. How can I remove this File from iPhone &

    How does one delete apps or files from iCloud Permanently so I may re-download without retrieving existing cloud file?for example the U2 Marketing fast , an Album I have no interest in...is now in my Cloud.. How can I remove this File from iPhone & cloud

    Hey there Matt.dvs1,
    Although there is not a way to remove past purchases from your iTunes account completely, you can hide them so that you don't have to see them if you don't want to. This article will help you do that:
    iTunes Store: Hiding and unhiding purchases - Apple Support
    Hide your purchases
    Open iTunes on your Mac or PC.
    From the Store menu, choose Store > Sign In, and then enter your Apple ID and password.
    Go to the iTunes Store.
    Click Purchased from the Quick Links section on the right side of the iTunes Store.
    Choose a content type by clicking Music, Movies, TV Shows, Apps, or Books from the top of the window.
    A list of your purchased items for the content type you are viewing will appear. Mouse over the item you want to hide until an X appears its top-left corner.
    A confirmation dialog will appear once you click the X.
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • HOW CAN I TRANSFER VIDEO FILES FROM MY PC TO IPAD MINI VIA ITUNES??? WITHOUT ANY ADDITIONAL DOWNLOADABLE APP

    HOW CAN I TRANSFER VIDEO FILES FROM MY PC TO IPAD MINI USING ITUNES???  i have to google every little thing that has to do with my ipad, why cnt they make it more user friendly???? i have to dl another app just so ican transfer vid files to mu ipad mini. i already converted them to the proper format. i just cant seem to find out how to transfer with with only itunes

    im just new to itunes and ipad mini is my first apple product thats why im really having a hard time with this. i cant transfer the video file to my library... i tried dragging it to the "movies" part in my library but it still doesnt copy to the movie librarry just like how i do it with my songs.. not even the typical list appears.... all it says is movies and studd about the library and itunes, ill post a pic so u can see...

  • How can I transfer "Pages" files  from my IPad to my Mac?

    How can I transfer "Pages " files from my IPad to my IMac, I cannot use ICloud because I have Mountain Lion installed on the IMac?

    Actually, you can use iCloud and the way that you so it is to log into iCloud.com on the Mac (use Safari for best results) click on the Pages icon and then drag the Pages files into the browser window. It works the other way around as well. Log into iCloud.com on the Mac and download the files from Pages (that you created on the iPad) in iCloud onto your Mac. You can click on the file in the documents window and select it to Download by clicking on the Gear icon or right click upon the file and select download.
    The files will then sync to the Pages app on the iPad - assuming hat you have use iCloud tuned on in Settings>Pages>Use iCloud>On. I have an iMac running Tiger 10.4.11 that I can still move Pages/Word files back and forth Iike this.
    Also, File Sharing with iTunes is a great way to move the files back and forth.
    iOS: About File Sharing - Support - Apple
    Message was edited by: Demo

  • How can I transmit PDF files from my Mac to my iPad, How can I transmit PDF files from my Mac to my iPad

    How can I transmit PDF files from my Mac to my iPad, How can I transmit PDF files from my Mac to my iPad

    Yes you can definitely do this. You'll need an app on the iPad that handles PDF viewing and editing. There are many around - two of the best I've seen are GoodReader and PDF Expert.
    In iTunes when you iPad is connected to your PC, go to the Apps tab and scroll down and you'll see the File Sharing section. You can drag files to there to share them to your iPad.
    You could also look at online file sync services like PDF to ePub Maker if you prefer not to have to connect your iPad to a PC

  • HELP! How can i restore/recover files from Bootcamp with Boot Failure - Missing operating system error?

    Hi,
    I am having a few problems with bootcamp on my imac. When i tried to move the bootcamp partition on windows 7 into free space, it crashed and turned off. Ever since i have had the error 'Missing operating system' and it fails to boot. I have some very important files on the bootcamp partition. Is it possible to recover these files or even to restore the bootcamp partition to it's original state? I do not have a backup of my bootcamp partition. Another problem i have is that ever since i tried to expand my macintosh HD partition into free space, when i hold alt while booting up (to choose which partition to boot like i normally do), the bootcamp partition has stopped appearing. This means that i cannot even boot the windows 7 bootcamp partition anymore!
    So basically here are my 2 questions:
    How can i restore/recover files from Bootcamp with Boot Failure - Missing operating system error?
    How can i make the Bootcamp partition appear in Startup Disk and when i hold the option key while starting up my computer to allow me to boot windows 7?
    Any solutions are very much apreciated!
    Thanks!
    I know that bootcamp (disk0s4) hasn't been fully deleted since it appears in disk utility (i cant do anything to it though)
    And here is the error i see when i try to launch bootcamp (back when i was actually able to boot up bootcamp to the error screen)

    WinClone 3 is OS X and saves Windows image it makes for restore - that should work but you will have to try and you would need to make a new image unless it also works with a native Windows system restore image. It is now supported and has come a long way.
    http://www.twocanoes.com/
    Paragon Clone OS works and does disk-to-disk clone just like CCC you end up with two bootable drives. But does not work with your setup. It would let you clone and move your Windows install to an SSD or another disk drive though and be bootable.
    During its clone process it checks for errors which is very helpful and lets you know - something CCC and others should adopt more of.
    http://www.paragon-software.com/downloads/demo.html
    I wish for our/my sake you had re-read and rewritten the long 'story' and broken it into a brief list of facts we needed.
    OS X
    Windows
    Backup (though external is much safer) and you want bootable OS X clones as well as TimeMachine
    https://support.apple.com/kb/HT1427
    https://support.apple.com/kb/HT1553
    There are a number of things to do like chkdsk and others as well as Windows DVD to do automatic system repairs and find out why.
    AppleHFS - the abilty to mount and read HFS volumes can be notorious.
    I would rearrange and redo your storage setup and how you use the 4-5 internal hard drive bays.

  • How can I download a video from the net? is there is any special download softwear than realplayer?

    how can I download a video from the net? is there is any special download softwear than realplayer?

    There are a variety of file formats for storing and sending video. You will probably want to install VLC, which handles most open formats. RealPlayer is used on their proprietary format.     
    http://www.videolan.org/

  • How can I open RAW files from Nikon D7100 in Photoshop Elements 9?

    How can I open RAW files from my Nikon D7100 in Photoshop Elements 9

    Three choices:
    1. Upgrade to PSE11
    2. download the free Adobe DNG Converter and then convert your RAWs to DNG, which will open in PSE9
    3. Use manufacturer's software and convert to TIF (or JPG)

  • How can I read text files from LAN if I only know the hostname?

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    <p>1. How can I read text files from LAN if I only know the hostname, or IP address?
    <p>2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.
    (ex. how can I read the 120th line?)
    <p>Please help!
    <p>sorry for the bad english

    I'm new in Java Developing, and dont know the written classes yet. I need help, how to do the following steps?
    1. How can I read text files from LAN if I only know the hostname, or IP address?You need to know the URL of the file. You need to know the hostname, port, protocl and relative path.
    The hostname is server, not file.
    2. How to read lines from text files without read all lines from the beginning of file, just seek to a position.Use the seek() to get to a random byte.
    (ex. how can I read the 120th line?)The only way to find the 120th line is to read the first 120 lines. You can use other file formats to find the 120th line without reading the whole file but to need to be able to detremine where the 120th line is

  • How do I download documents/files from a memory stick onto my MacBook Pro into organised folders

    How do I download documents/files from a memory stick on to my MacBook Pro and organise in to Folders?

    Hi RockingRon,
    Welcome to the Support Communities!
    The Finder application on your Mac is what you need to organize and manage files.  The link below will explain how to use it.  See item #8 - your memory stick will appear in the Devices section of the Sidebar on the left.
    Mac Basics: The Finder
    http://support.apple.com/kb/ht2470
    Mac Basics: Applications, files, and folders (OS X Lion)
    http://support.apple.com/kb/ht2476
    Organizing files and folders
    If you want to add more folders to set up an organizational scheme, here's how to create a new folder:
    Make the Finder active (click the desktop, click inside any Finder window, or click the Finder icon in the Dock).
    From the File menu, choose New Folder; a new "untitled folder" icon appears in the active Finder window.
    Name your folder by simply typing a name in the highlighted text box next to the folder icon.
    Or, you can simply press the Shift-Command-N key combination.
    To organize your files and folders, drag any file, folder, or application that you want into your new folder, or drag the folder into any other folder to establish an organized hierarchy.
    Cheers,
    - Judy

Maybe you are looking for

  • How to open a form from Oracle XML Report .xls Output?

    Hi All, We have a requirement wherein we have one complex SQL query, requirement is to fetch the data from that query and show it to the user. So far, so good. We can either create a report thru' UTL file to show the output to the user or can create

  • PowerMac G3 display

    I got an old PowerMac G3 B&W from a friend and it came with the matching Apple Studio CRT with VGA output. The problem I am having is getting the tower hooked into a display, it has onboard Svideo and the ATI Rage card has the Apple display port inpu

  • From hard drive to premiere - can I import the file structure as well?

    I got a hard drive from a client where all assets I need are in perfect order (video, audio, music, animation, graphics, etc.) which means it's a quite complex yet reasonable structure with lots of subfolders. Is there a way to import all the assets

  • Report Manager & Essbase

    Does anyone know if you can use Microsoft Report Manager to connect to Essbase?  If so, is there an additional licensing needed?

  • Whatever happened to the Gurus....

    I still don't have a solution to this... Get duke dollars by responding... I'm having some trouble displaying the Flags of my messages; Check out the following piece of code: Flags flags = message.getFlags(); Flags.Flag[] sf = flags.getSystemFlags();