PHP upload file with resume functionality - java

Hi I have a question, I want to do an upload script that can take rather big files 500MB, 1GB
and upload it with resume functionality. Is this possible with just PHP or is there other solution like Java Applet, Flash and which one would be best for this case?

PHP is a server-side language so you really can't subsitute it with a Java Applet or Flash. Those are client-side technologies executed inside the browser. For uploading you need both a client and a server.
Resuming a HTTP upload is not possible, no matter the HTTP application platform, whether it's J2EE, Python, Rails or ASP.NET. It's just the restriction of the HTTP protocol.
One way to accomplish the resume functionality is by having the files uploaded into a standards-compliant FTP server, using a proper browser component. In that case you'd need a custom input solution, perhaps a Java Applet such as jClientUpload. Files in size of several hundred megabytes are too much for Flash.

Related

How to capture all Network traffics(http\https) of a Web Application using Java in Eclipse IDE?

I want to record a Web Application traffic using Java code in the back-end and replay it after recording.
Is there any way to record Web Application traffic like we do in Load-runner using Java code?
Although it doesn't automate everything or is not specific to Java, you can use Wireshark to retrieve HTTP/HTTPS requests and export them ( https://www.wireshark.org/docs/wsug_html_chunked/ChIOExportSection.html ). Some other tools such as PlayCap allow to directly playback the wireshark capture.
Or you can write some Java code that mimics the requests and even load the wireshark capture file to send logged requests with any HTTP-able library.
You can also use directly pcap to retrieve packages (or the jpcap variant, written in Java, that may have some reusable code for your use-case), and try the similar approach to playback the capture.

NPAPI alternative for live file editing

I currently have a web app, which allows users to download files to their computers, edit them with their own editors and automatically sends them back to server upon saving and sends some extra data when closing the file. It utilises a Java applet to handle the client side processing which includes
file download,
sending request to lock the file,
opening the file in default desktop app,
watching for changes,
file upload back to server,
sending request to unlock the file upon closing.
Since chrome will stop supporting NPAPI in September, I need to create an alternative while maintaining the funcionality. I wasn't able to find many alternatives. The only thing I found that would be able to achieve at least something is Native Messaging, but still I can't imagine how could I use it to emulate the behavior of the java applet.
So the question is - what are possible alternatives I can use to replace the applet?
Looking at your comments, I'm going to break down your question into 2 basic questions:
How does native messaging work?
How do I download a file and launch it in an application, etc, in a windows application?
Native messaging essentially allows you to launch an application (which must be registered when installed to allow it to work this way) which can communicate with your extension. You can then talk back and forth with your native messaging application from your extension (or from the web page proxying requests through your extension); your messages have to be essentially json formatted (on the javascript side you provide json encodable values and on the executable side you have to read that from stdin and parse it, then write to stdout the result; there are also 2 byte integers preceding each message indicating the length of the message).
basically once you have communications, you just have to make your application be able to respond to a message that tells it to download the file by doing so, etc. This is something you'll have to figure out how to do -- you could do it with a python script, a windows exe, a .net app, or whatever you want that can be executed, but each has advantages and disadvantages.
Hope that helps

Posting Processing code onto a website?

I have exported some Processing code (outputs sensor data to a textbox) to an
applet that includes the .jar and .html files. I have tried to insert this html on a
simple website that I created and the java applet doesn't work. Do I have to somehow
modify the html? I know that the .jar files are already in the same directory and
are referenced appropriately in the exported html code. Is there a better approach
to posting to a website? Thank you
I don't think that it is possible, due to security restrictions on applet communication.
More than likely you will have to write a small client/server program using sockets.
The idea would be to transmit the the output from your locally running client application to your applet(server) which would receive and display the data.
You could use any language with socket support obviously(Flash, PHP, etc.), but I assume you will want to stick with Java.

Stream mp3 using Java technology

**I need to buid distributed computing system that use java technology to access mp3 files stored in seperate servers.
In the user interface layer users can play audio files.
In the information processing layer application client implementing with database servers.(where audio and user data stored)
In the information processing I need to be able to manage audio files.
My questions are,
What is the best framework to get started?
Am I able to use different technologies like SmartGWT, SmartGWT EE, mySQL, JSF together?
What is the best mp3 player that work with java?**
(Assuming your client is a browser)
The easiest way:
On the client side use a Flash player that plays mp3 downloaded via HTTP. You can write your own or pick one on the web (there are plenty available): example.
Serve your mp3 files as static files via a web server, or write Java Servlet that serves this files. In second case you could have more control and implement progressive HTTP download.
I'll only answer question about streaming:
There's the locality-icecast project that implements an icecast streaming server in java, but it was abandoned, so you can pick up the development. You can also take a look at JRoar, it's an icecast server for ogg, but it's generally same thing and you can get some ideas from it too.
This way any player that supports shoutcast/icecast protocol will work with your server.
If you want to write your own player, you can decode mp3 using JavaLayer library.

Best way to upload multiple files from a browser

I'm working on a web application. There is one place where the user can upload files with the HTTP protocol. There is a choice between the classic HTML file upload control and a Java applet to upload the files.
The classic HTML file upload isn't great because you can only select one file at a time, and it's quite hard to get any progress indication during the actual upload (I finally got it using a timer refreshing a progress indicator with data fetched from the server via an AJAX call). The advantage: it's always working.
With the Java applet I can do more things: select multiple files at once (even a folder), compress the files, get a real progress bar, drag'n'drop files on the applet, etc...
BUT there are a few drawbacks:
it's a nightmare to get it to work properly on Mac Safari and Mac Firefox (Thanks Liveconnect)
the UI isn't exactly the native UI and some people notice that
the applet isn't as responsive as it should (could be my fault, but everything looks ok to me)
there are bugs in the Java UrlConnection class with HTTPS, so I use the Apache common HTTP client to do the actual HTTP upload. It's quite big a package and slows down the download of the .jar file
the Apache common HTTP client has sometimes trouble going through proxies
the Java runtime is quite big
I've been maintaining this Java applet for a while but now I'm fed up with all the drawbacks, and considering writing/buying a completely new component to upload theses files.
Question
If you had the following requirements:
upload multiple files easily from a browser, through HTTP or HTTPS
compress the files to reduce the upload time
upload should work on any platform, with native UI
must be able to upload huge files, up to 2gb at least
you have carte blanche on the technology
What technology/compontent would you use?
Edit :
Drag'n'Drop of files on the component would be a great plus.
It looks like there are a lot of issues related to bugs with the Flash Player (swfupload known issues). Proper Mac support and upload through proxies with authentication are options I can not do without. This would probably rule out all Flash-based options :-( .
I rule out all HTML/Javascript-only options because you can't select more than one file at a time with the classic HTML control. It's a pain to click n-times the "browse" button when you want to select multiple files in a folder.
I implemented something very recently in Silverlight.
Basically uses HttpWebRequest to send a chunk of data to a GenericHandler.
On the first post, 4KB of data is sent. On the 2nd chunk, I send another 4K chunk.
When the 2nd chunk is received, I calculate the round trip it took between first and 2nd chunk and so now
the 3rd chunk when sent will know to increase speed.
Using this method I can upload files of ANY size and I can resume.
Each post I send along this info:
[PARAMETERS]
[FILEDATA]
Here, parameters contain the following:
[Chunk #]
[Filename]
[Session ID]
After each chunk is received, I send a response back to my Silverlight saying how fast it took so that it can now send a larger
chunk.
Hard to put my explaination without code but that's basically how I did it.
At some point I will put together a quick writeup on how I did this.
I've never used it with files of 2GB in size, but the YUI File Uploader worked pretty well on a previous project. You may also be interested in this jQuery Plugin.
That said, I still think the Java Applet is the way to go. I think you'll end up with less portability and UI issues than you expect and Drag/Drop works great. For the record, Box.net uses a Java Applet for their multi-file quick uploads.
OK this is my take on this
I did some testing with swfupload, and I have my previous experience with Java, and my conclusion is that whatever technology is used there is no perfect solution to do uploads on the browser : you'll always end up with bugs when uploading huge files, going through proxies, with ssl, etc...
BUT :
a flash uploader (a la swfupload) is really lightweight, doesn't need authorization from the user and has a native interface which is REALLY cool, me thinks
a java uploader needs authorization but you can do whatever you want with the files selected by the user (aka compression if needed), and drag and drop works well. Be prepared for some epic bugs debuggin' though.
I didn't get a change to play with Silverlight as long as I'd like maybe that's the real answer, though the technology is still quite young so ... I'll edit this post if I get a chance to fiddle a bit with Silverlight
Thanks for all the answers !!
There are a number of free flash components that exist with nice multiple file upload capability. They make use of ActionScripts FileReference class with a PHP (or whatever) receiver on the server side. Some have recently broken with the launch of FP10 but I know for certain that swfupload will work :)
Hope this helps!
What about these two
Jupload
http://jupload.sourceforge.net/
and
jumploader
http://jumploader.com/
Both are java applets but they are also both really easy to use and implement.
what about google gears?
There are HTTP/HTTPS upload controls that allow multi-file upload. Here is one from Telerik, which I have found to be solid and reliable. The latest version looks to have most if not all of your feature requirements.
You can upload multiple files with HTTP forms as well, as Dave already pointed out, but if you're set on using something beyond what HTTP and Javascript offers I would heavily consider Flash. There are even some pre-existing solutions for it such as MultiPowUpload and it offers many of the features you're looking for. It's also easier to obtain progress information using a Flash client than with AJAX calls from Javascript since you have a little more flexibility.
You may check the Apache Commons FileUpload package. It allows you to upload multiple files, monitor the progress of the upload, and more. You can find more information here:
http://commons.apache.org/fileupload/
http://commons.apache.org/fileupload/using.html
Good luck

Categories

Resources