Unzip - zip file
Can any one give some info regarding extracting a uploaded zip file on server from my web application..
my environment is...
IBM websphere
Struts frame work.
My uploaded zip file contains some excel sheets and some images.
each image name is mentioned in excel sheet.
I need to migrate the contents in excel to database.
My each excel sheet contains a Learning Course for a online exam with couple of Questions.
each Question in may containg some image.
so, my problem is uploading the contents of course in excel sheet to database along with images names as
course1_question1_imagename.gif
I am expecting some suggestions and help from the FORUMS.
I am expecting some suggestions and help from the
FORUMS.
good luck
Similar Messages
-
Easy way to unzip zipped files?
I'm trying to figure out an easy way to unzip zipped files. I'm using C# in VS 4.5.
I download this:
http://dotnetzip.codeplex.com/
I couldn't get any dlls installed. I couldn't set any reference to anything.
I also tried to follow the example here:
http://www.danderson.me/posts/zipfile-class-system-io-compression-filesystem/
I can't find anything titled 'System.IO.Compression.dll'. I set a reference to these two:
System.IO.Compression.FileSystem
System.IO.Compression
That did nothing at all.
For instance, I think this should work:
using System;
using System.IO;
using System.IO.Compression;
namespace ConsoleApplication
class Program
static void Main(string[] args)
string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
string extractPath = @"c:\example\extract";
ZipFile.CreateFromDirectory(startPath, zipPath);
ZipFile.ExtractToDirectory(zipPath, extractPath);
However, i keep getting an error message that says 'The name 'ZipFile' does not exist in the current context'.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.Hi
Please include the below namespace and try it out.
System.IO.Compression.FileSystem
The code would be like this.
using System;
using System.IO;
namespace ConsoleApplication
class Program
static void Main(string[] args)
string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
string extractPath = @"c:\example\extract";
System.IO.Compression.ZipFile.CreateFromDirectory(startPath, zipPath);
System.IO.Compression.ZipFile.ExtractToDirectory(zipPath, extractPath);
Please note that you need to add a DLL reference to the framework assembly
System.IO.Compression.FileSystem.dll
Please let me know in case of any questions you may have around this. Thank you. -
How to check & unzip zip file using java
Dear friends
How to check & unzip zip file using java, I have some files which are pkzip or some other zip I want to find out the type of ZIp & then I want to unzip these files, pls guide me
thanksHow to check & unzip zip file using java, I have
ve some files which are pkzip or some other zip I
want to find out the type of ZIp & then I want to
unzip these files, pls guide meWhat do you mean "other zip"? Either they're zip archives or not, there are no different types. -
When I unzip .zip files I get an alias ?
I've unzipped .zip files for years, but with Lion, unzipping a .zip file (created in Snow Leopard) does not result in a set of files, it results in a set of aliases which do not point to any file when I select "Show Original."
Any advice appreciated.The current version of the built-in Archive Utility has problems with some zip files. Use "The Unarchiver" instead -- free in the App Store.
-
I regularly download zipped files from Survey Monkey. Since the latest security update, the zipped files download to my computer, but when I try and unzip them I get a message telling me the file is in use by another application. If I reboot, I can unzip the file, or if I'm in Safe Mode when I download the file it unzips fine.
I have tried three different unzip apps and all have the same trouble. Everything was working well after the September 5 update.
I'm running Windows XP with McAfee antivirus, Spybot, Ad-Aware and Malbytes Anti-malware. All are up to date.The URL below is to Adobe's Acrobat update page.
There you'll find each of the incremental updates to Acrobat 10.
They must be installed one at a time in sequence.
http://www.adobe.com/support/downloads/product.jsp?product=1&platform=Windows
Now, if after attempted updates fail then you'll need to speak with your IT Department.
You need your install of Acrobat 10 updated to dot version 10.1.7.
Be well...
Message was edited by: CtDave -
Auto unzip "zipped" files inside OWB. possible?
Scenario:
Client will be placing large fixed-delimited files in a directory w/c are in ZIPPED format. This file directory will be my source location.
Question?
Is there a way to automate the process of unzipping the files in OWB and placing it in the same directory. I am thinking of using a process flow but I cannot find any utility activity for this. Any suggestions?
Thanks
-carloI haven't done it for a while, but I manage to archive files from the workflow via a script.
In the workflow you have to use the ExternalProcess command. -
Hi,
I found many ways to unzip a ZIP archive,
but which is the best way in term of performance ?
I found some examples doing :
ZipFile zipFile = new ZipFile( file ) ;
Enumeration entries = zipFile.entries() ;
while( entries.hasMoreElements() ) {
ZipEntry entry = ( ZipEntry )entries.nextElement() ;
// extract entry
Others :
ZipEntry zipentry;
zipinputstream =
new ZipInputStream(
new FileInputStream(zipFile));
zipentry = zipinputstream.getNextEntry();
while (zipentry != null) {
// extract entry
zipentry = zipinputstream.getNextEntry();
For extracting the entries I saw examples using BufferedInputStream and BufferedOutputStream
BufferedInputStream is =
new BufferedInputStream(zipFile.getInputStream(entry));
int currentByte;
// establish buffer for writing file
byte data[] = new byte[1024];
// write the current file to disk
FileOutputStream fos = new FileOutputStream(destFile);
BufferedOutputStream dest =
new BufferedOutputStream(fos, 1024);
// read and write until last byte is encountered
while ((currentByte = is.read(data, 0, 1024)) != -1) {
dest.write(data, 0, currentByte);
dest.flush();
dest.close();
is.close();
others using ZipInputStream and FileOutputStream :
zipinputstream =
new ZipInputStream(
new FileInputStream(zipFile));
int n;
FileOutputStream fileoutputstream;
File newFile = new File(entryName);
String directory = newFile.getParent();
if (directory == null) {
if (newFile.isDirectory())
break;
fileoutputstream =
new FileOutputStream(destinationname + entryName);
while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
fileoutputstream.write(buf, 0, n);
fileoutputstream.close();
zipinputstream.closeEntry();
Can u tell me which solution to use for looping through the files (by this Enumertion or by checking nextEntry is null ?)
And for the extracting (use of BufferedInp. BufferedOutp. or ZipInputStream and FileOutputStream?) in term of performance
Thank u for any tips
Message was edited by:
matt.webdev
Message was edited by:
matt.webdev
Message was edited by:
matt.webdevHi there,
Pl see code below. For example, create a file named "interest"on your c:\test\interest in notepad with your recordkey line info.
recordKey dollarAmount interestRate years
1234 50 3 4
5678 60 4 5
9876 70 5 6
8765 80 6 7
program below extracts recordKey line info if available in file.
import java.io.*;
public class SearchString
String message = "9999";
public static void main(String args[])
SearchString ss = new SearchString();
ss.searchFile("1234");
public String searchFile(String sRecordKey)
try
BufferedReader br = new BufferedReader(new FileReader("c:/test/interest.txt"));
String str = "";
while((str = br.readLine()) != null)
// passing a specific recordKey to search
if (str.indexOf("5678") != -1)
System.out.println(str);
message = str;
catch (IOException e)
System.out.println("Could Not Search File");
return message; -
hai,
Iam trying to unzip a file but its not working.
//Unzip a file
final int BUFFER = 2048;
String zfname=application.getRealPath("/") + "temp/Bulk.zip";
File zf=new File(zfname);
try {
BufferedOutputStream dest = null;
FileInputStream fis = new FileInputStream(zf);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
ZipEntry entry;
while((entry = zis.getNextEntry()) != null)
System.out.println("Extracting: " +entry);
int count;
byte data[] = new byte[BUFFER];
// write the files to the disk
File outFile=new File(outPath);
//FileOutputStream fos = new FileOutputStream(outFile);
FileOutputStream fos = new FileOutputStream(entry.getName());
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER))!= -1)
dest.write(data, 0, count);
dest.flush();
dest.close();
zis.close();
} catch(Exception e) {
e.printStackTrace();
Bulk.zip folder has the following files:
Bulk/test.txt
Bulk/fm.jsp
I get the following exception
java.io.FileNotFoundException: Bulk\test.txt
(The system cannot find the path specified)
Iam i making mistake in this line
FileOutputStream fos = new FileOutputStream(entry.getName());
dest = new BufferedOutputStream(fos, BUFFER);Thanks,
Thanuja.ok vijay iam so sorry for not mentioning how i rectified it. somehow i missed it. may be was bit excited when i got the result.
anyways below code worked.
//Unzip a file
String zip_fname=request.getParameter("zfilename")!=null?request.getParameter("zfilename"):"";
String fromZip=zip_fname;
//out.println("FromZip:"+fromZip);
File zipFname=new File(newFileName);
String toLocation=newFilePath; //path to unzip the file
String seperator = System.getProperty("file.separator");
System.out.println("unzipping zip file to "+toLocation);
try
BufferedOutputStream dest = null;
File zipDir = new File(toLocation);
zipDir.mkdir();
ZipFile zip = new ZipFile(fromZip);
final int BUFFER = 2048;
FileInputStream fin=new FileInputStream(fromZip);
ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fin));
ZipEntry entry;
while((entry = zis.getNextEntry()) != null)
//System.out.println("Extracting: " +entry);
int count;
byte data[] = new byte[BUFFER];
String zip_Fname=entry.getName().substring(entry.getName().lastIndexOf("/")+1);
if(!zip_Fname.equals(""))
zipFiles.add(zip_Fname);
if(!zip_Fname.equals(""))
FileOutputStream fos = new FileOutputStream(toLocation + seperator + entry.getName().substring(entry.getName().lastIndexOf("/")+1));
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER))!= -1)
dest.write(data, 0, count);
dest.flush();
dest.close();
zis.close();
catch (Exception ex)
unZipResult++;
System.out.println(ex);
}Thanks,
Thanuja. -
How do I create and send a zip file? I have Lion and I'm working in Word for mac
To show you how little I know about any of this, I don't even know if this is the correct forum in which to ask this question. I'm a copywriter. I have a client in France. I have 15 word documents, 15 of the same documents in PDFs and a small Excel document to send him. Simple, mutlipage Word docs. Short two-page Excell sheet. I want to create a zip file for them to send to him. Can I do it? How? I have unzipped zip files other people have sent to me, but I've never created or sent one myself. I'm working in Word for Mac 2011. I have Lion. I'm using Mac's email. Please don't assume I know anything. I need very, very simple, play by play instructions. You are all very helpful, so I have high hopes.
NancyVisit:
http://download.cnet.com/MacZip/3000-2250_4-10025248.html
You will be able to both zip and unzip. If the recipient of your zipped file does not have zip, he/she will need to get it, or you could send him/her the above address so that he/she can unzip his/her file.
(I wish the English language could settle on the use of something less clumsy that he/she him/her etc.)
BTW, I think that you can zip only folders, not separate files, so put even one file into a folder before zipping).
Message was edited by: SteveKir Added BTW -
Hi all,
I've never done any compression-decompression work with Java. I've got some help as to how to unzip .zip files, but am unable to unzip .gz files. Does anyone know how to accomplish this?
All help is appreciated!I've never done any compression-decompression work
with Java. I've got some help as to how to unzip .zip
files, but am unable to unzip .gz files. Does anyone
know how to accomplish this?Implement it yourself or Google for a lib. JSE can only handle ZIPs. -
How do I stop LION from ZIPPING up ZIP files (again?)
Yup _ you heard it LION helpully now re-zips files that I want to UN ZIP
I have seen ther posts across the web on this new "feature"
Any suggestions on how to use Archive utlity to do what it is supposed to do, which is UNZIP ZIP files, not double-zip them
Many thanks
TPUncheck:
-
I've been using Mac for 13 years and recently bought a used iMac Intel w/OS 10.4.10. I tried downloading iPhoto Buddy yesterday and the dmg.zip file on my desktop wouldn't open. Finally I downloaded Stuffit Expander and it opened OK. I thought OS 10.4 had replaced Stuffit Expander? If so, why didn't it open the file?
The built-in OS X BOMArchiveHelper.app zips & unzips .zip files. You need Stuffit Expander for other types of compressed files such as .sit.
-
Extension for creating a zip file and unzipping it
Iam totally new to Dreamweaver and the extensions. So please
help me with this.
Assuming i have a .zip file and it contains some html pages
along with css and gifs.
The req is to have an Import option, which given this zip
file, can unzip its contents. The user can work on these html
pages. When the user finishes working on them, I need an export
button so that we can package the entire stuff back into a zip
file.
How can i implement this ?
Is there any extension that is available for this ?
Eagerly looking forward to some useful answers...
Thanks in advance,
GaneshThere used to be one .. I'm not sure if that was in DMX time
or DMX 2004
time .. that, when installed, allowed you to select files
from the site
folder or the whole thing and create a zip from them. I don't
remember what
it was called or who created it .. but it might be on one of
my archived
disks or zips .. I'll try to check it out later today.
Nancy Gill
Adobe Community Expert
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August,
2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004:
A Beginner''s
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP
Web Development
"Ganesh Ram" <[email protected]> wrote in
message
news:engarc$d62$[email protected]..
> Iam totally new to Dreamweaver and the extensions. So
please help me with
> this.
>
> Assuming i have a .zip file and it contains some html
pages along with css
> and
> gifs.
> The req is to have an Import option, which given this
zip file, can unzip
> its
> contents. The user can work on these html pages. When
the user finishes
> working on them, I need an export button so that we can
package the entire
> stuff back into a zip file.
>
> How can i implement this ?
> Is there any extension that is available for this ?
>
> Eagerly looking forward to some useful answers...
>
> Thanks in advance,
> Ganesh
>
> -
Zipped files created with Java won't unzip with Java
Hello there,
I have written a class for unzipping a zip file using the 'ZipFile' class. It works perfectly fine when I extract zip files that have been created with XP, Winzip, or Winrar.
I am now experimenting with creating zip files using the ZipOutputStream (http://forum.java.sun.com/thread.jspa?forumID=256&threadID=366550 by author smeee). The code works great for creating the zip file, but when I try and unzip it with the zipfile class mentioned above it throws an exception.
The error that the following code gives me when it tries to convert an element from the enumeration to a ZipEntry is this: java.io.FileNotFoundException: C:\testfiles\out\high\BAUMAN\00001.jpg (The system cannot find the path specified)
NOTE: The file is there by the way!!! :-)
See the code for extracting here:
try {
zippy = new ZipFile(fileName);
Enumeration all = zippy.entries();
while (all.hasMoreElements()) {//loop through all zip entries
getFile((ZipEntry)all.nextElement()); <<<=====FAILS HERE
} catch (IOException err) {
System.err.println(err.toString());
return;
}Now if I extract the zip file with winzip, then rezip it with winzip and run the above method again it works with no errors. Any thoughts. Any help would be greatly appreciated.
JaredHello All,
For anyone else who use the forum posting by smeee as a guide to create a zipper (http://forum.java.sun.com/thread.jspa?forumID=256&threadID=366550 by author smeee).
I was tracing through the code and found that there is a statement that adds 1 character (strSource.length()+1) to the source path. This was causing the following bug:
In windows it was placing objects like this \myfolder\myfile.txt
In unix it was placing objects like this yfolder\myfile.txt
Naturally a path like \myfolder... in the zip index was causing problems. I have added a case statement that tests the OS and then adds two chars if windows to compensate for the 'C:' and does nothing if Unix. The code now runs perfectly on either OS.
Thanks for your response guys!
Jared -
PI FTP get zip file and want to unzip with origin filenames
Hello everybody,
we get zip files from ftp and want to unzip this file in one target directory (file adapter). May be, there are more than one file in the zip file, for example test1.txt,test2.txt,test3.txt and zip file name is zipexample.zip. With adapter parameters it is possible to use the name of the zip file, but I've no idea to get the origin filenames (test1.txt, ...).
I don't want to use the OS Commands to do this.
I know that's not realy an workitem for PI.
Is there anyone, who has an idea. Thanks
Kind regards - JochenHi,
Try out this blog
Working with the PayloadZipBean module of the XI Adapter Framework
regards,
venkat.
Maybe you are looking for
-
My Back and Refresh buttons are not registering/working, how do I fix it?
''Duplicate post, continue here - [https://support.mozilla.com/en-US/questions/813027]'' On about 80% of the pages I am on, my back button and my refresh button will not work. The back button will not recognize that I have been to previous pages in t
-
I want to connect to a bluetooth enabled device but don't know how
I don't know how to connect to my bluetooth enabled device. Please help.
-
What is the life of an Apple bluetooth keyboard
I.have.had.a.27ins.iMac.since.2009...the.keyboard.now,.has.several.faulty.keys.. .....(inc.the.space.bar)... How.long.should.it.last.....no.spills.no.other.problems. iMac/.27ins.2009.Snow.Leopard
-
Hi everyone! I'm new to java programming and looking for a java class called JPlot2D. I have a java application that needs this class to run and i'm using netbeans v3.6 to write the programme. Please if anyone can help ,do it quickly.
-
Safari Showing Garbled text why
I saw a similar post on this & there was a link to font Finagler. I tried it & still no luck. If I select the copy & past in a text edit doc. it reads fine. It also loads correctly in Fire Fox. So I believe it pertains strictly to Safari ? Here's a s