Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2007

Tip: Looking for answers? Try searching our database.

Large file uploads using Java

Thread view: 
heather.fraser@gmail.com - 14 Oct 2007 05:17 GMT
I am well aware of several file upload servlets & libraries (including
the one from Apache/Jakarta).

However, how does one go about creating a web-based file upload
similar to Whalemail (www.whalemail.com) or many of the AJAX web2.0
sites I see where they show the status of the upload (in KB and %age)
as the upload progresses ?

Also I now find myself with the need to upload files as large as 500
MB over a Local Area Network - is the servlet going to be able to
handle this or will it try to cache the uploaded data in memory and
therefore run into memory limits on the server ?

Thank you for any advice,

Heather
Arne Vajhøj - 14 Oct 2007 05:35 GMT
> I am well aware of several file upload servlets & libraries (including
> the one from Apache/Jakarta).
[quoted text clipped - 8 lines]
> handle this or will it try to cache the uploaded data in memory and
> therefore run into memory limits on the server ?

500 MB in memory should be OK on todays HW.

But let us assume DVD sise instead of CD size.

I don't think Jakarta Common FileUpload can stream directly from
request to final destination.

But I think Com Oreilly Servlet can.

I have some code somewhere that can show uploaded bytes
being incremented in a separate window (a refreshing window - this
was made before AJAX became popular).

Arne
heather.fraser@gmail.com - 14 Oct 2007 08:52 GMT
Thank you for the input, Arne.

You're right actually - we WILL need to be able to upload DVD-sized
objects at some stage.  Architecturally, one of the key considerations
has been whether we should use the web browser (and HTTP) for file-
upload/transfer; or FTP separately & then regularly ingest the files
on the server - but this introduces the problem of synchronizing the
uploaded file with the user & the adding of meta data. In the long
term, we believe all things are going the web-route and it is easier
for the end users.

We already use the Oreilly servlet actually so we'll see what happens
with massive gargantuan file uploads and whether the JVM & Tomcat
choke.  However, how does one show & dynamically update the percentage
uploaded with this?

Thanks again,

Heather

On Oct 14, 12:35 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
> heather.fra...@gmail.com wrote:
> > I am well aware of several file upload servlets & libraries (including
[quoted text clipped - 24 lines]
>
> Arne
Arne Vajhøj - 14 Oct 2007 22:51 GMT
> We already use the Oreilly servlet actually so we'll see what happens
> with massive gargantuan file uploads and whether the JVM & Tomcat
> choke.  However, how does one show & dynamically update the percentage
> uploaded with this?

If you read directly from network stream to file stream, then it should
not require much memory.

Just save percentages in session and have a refreshing window that
calls something that retrieves that value.

Arne
heather.fraser@gmail.com - 15 Oct 2007 13:47 GMT
On Oct 15, 5:51 am, Arne Vajh?j <a...@vajhoej.dk> wrote:
> heather.fra...@gmail.com wrote:
> > We already use the Oreilly servlet actually so we'll see what happens
[quoted text clipped - 7 lines]
> Just save percentages in session and have a refreshing window that
> calls something that retrieves that value.

Wow, that's a fantastic idea and so simple.  Thank you so much, Arne,
I always thought it was so much more complicated than that :-)
Roedy Green - 14 Oct 2007 10:29 GMT
>Also I now find myself with the need to upload files as large as 500
>MB over a Local Area Network - is the servlet going to be able to
>handle this or will it try to cache the uploaded data in memory and
>therefore run into memory limits on the server ?

See the code for download at
http://mindprod.com/products1.html#FILETRANSFER

It uses use a read method that reads in chunks.  You could attach your
progress bar to that to jump x ticks for every byte read in the chunk.
You have to change the read to a write, but the skeletons you need are
there.

see http://mindprod.com/jgloss/progress.html

You need something on the server side to decide when to accept files.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 15 Oct 2007 02:55 GMT
On Sun, 14 Oct 2007 09:29:10 GMT, Roedy Green
<see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :

>See the code for download at
>http://mindprod.com/products1.html#FILETRANSFER

for giant files, you need ether to be able to restart part way through
or you need to transfer in chunks, perhaps a meg each. Then combine
them when all done.  You also want to compress them.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

heather.fraser@gmail.com - 15 Oct 2007 13:45 GMT
> >See the code for download at
> >http://mindprod.com/products1.html#FILETRANSFER

Thank you. I shall take a look.

> for giant files, you need ether to be able to restart part way through

Yes, that's a good point. This is turning out to be not such a trivial
upload question after all.

> or you need to transfer in chunks, perhaps a meg each. Then combine
> them when all done.  You also want to compress them.

Giant files tend to be binaries so I'm not sure the compression is
going to help that much, is it ?

Thanks for the help,

Heather.
Lew - 15 Oct 2007 14:22 GMT
> Giant files tend to be binaries so I'm not sure the compression is
> going to help that much, is it ?

Binary files compress.  Typical binaries, like visual images or program code,
display enough regularity for compression to be effective.

Encrypted or already-compressed files are another matter.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.