Looking for a descent looking Java File Upload Applet (or even Flash) that fits the following requirements:
Free/cheap (yes looking to use in a commercial web application)
Preferably allow multiple file selection
Ability to create/edit folders on destination server? (within a secure root folder)
Ability to overwrite files in the destination directory?
IE + Firefox support required... Safari, Chrome, etc. a bonus
Ability to "hook" into the flow to apply additional logic
Notes:
In particular I'm looking for the ability to upload to a directory on another server (e.g. not where my web server or app server is running)
The destination server has a shared drive where all users of the app have permission to store files.
By "decent looking" I'd really, really like to avoid a UI that is "skinned" like this:
(source: swtguibuilder.com)
Before I'm shut down for "not programming related" I would need to be able to hook into such an applet to apply some additional permission logic etc. I don't want to re-invent the wheel if someone else has made a component that already does what I need.
This is relatively easy with Java. Look into Apache Commons Fileupload for the server-side code. For the front-end, there are many examples of flash-based file uploads.
The simple answer to your question used to be Flash. Since the release of Flash Player 10 it isn't anymore. Adobe has added a restriction on File upload which only allows a file to be uploaded in the scope of UIA - User Initiated Action. This means that a file upload must be started with a mouse click.
There are some of free file uploaders built in flash available. The only problem is that the queuing is broken by FP10. Adding the files to the pending uploads list is no problem. Starting the upload is no problem either. But when one file upload is done and the next should begin, Flash Player will not allow it if you don't click again which is pretty much useless.
There at least two requirements:
Applet file uploader These are available, e.g.: http://sourceforge.net/projects/jupload/
Widget to configure destination This is unusual in my experience, but I wrote one once for a Swing app which would be similar for an applet. It was necessary to provide the user a view of the remote file system, enable manipulation of the view, and then upload the changes. Note that there are transactions issues here, so it's not trivial.
Related
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
I'm working on a web application which needs to download/upload a file from/to the server. The user base for this application, however, is not tech savvy so we we want them to click a button that indicates "Download file" (for this record) or "Upload file" (for this record) without having to rely on the user to "Save As" or indicate the destination folder. In a previous version we've used Software Artisan's SAXFile (an ActiveX control) however we're trying to avoid ActiveX this time around. We're hoping to make the application browser agnostic.
Any suggestions about how to do this? I'm assuming we'll have to do a java applet, but if there's an existing open source project or control I'd rather not roll my own.
This is a security issue, that's why there's not many good options out there. The ability to write to an arbitrary directory is definitely not something that should be granted to any web page.
Your options are a Java Applet, Flash, HTML5, or ActiveX, but all of those require the user to grant permissions, or select a location. You could also accomplish this with HTML5 Web storage, which doesn't require user permissions, but is more limited, both in storage format, browser support, and size limits (5 or 10 MB for most browsers)
I have a need to "pop up" operating system folders from my web app, mostly to locate files in them. My users don’t want to use a conventional web upload/download paradigm. I have 7 or 8 static folders that need to be opened in explorer on a PC or in Finder on a mac. These folders are all network available, but are buried, and for convenience need to be shown on a web page.
There are IE tricks to do this, and I've written a sample flash app that only allows the browser to open, but I know most browsers sandbox this, and keep me from calling these folders. I am aware that some Java libraries deal with the opening of folders, does anyone have any thoughts or samples for this?
The only way I can imagine is to create a Signed Java Applet.
Applets cannot access the filesystem (and a lot of other ressources) if they are not valid signed. Maybe you can also grant the permission by a policyfile.
There ist a tutorial at JavaRanch.
But I am not sure, if this solution will be very helpful, because the JavaPlugin will be removed from a lott of browsers in near future. (I think FireFox already removed it).
I think there is actually NO solution to this problem.
There may be some workarrounds:
Put a Batch-File onto the server, which opens the folder, if executed
Can you create a local service, which handles requests from you webpage and opens the folder.
Create a webapplication, which opens the folder at serverside, and create a webpage, which displays the content in you website.
I have developed a command-line (read: no GUI) Java application which crunches through numbers based on a given dataset and a series of parameters; and spits out a series of HTML files as resultant reports. These reports hold a large amount of data in tables, so in order to give the users a easy and quick overview of the results, I utilized the JUNG2 library and created a nice graph.
Here's where it gets interesting; since I would like the graph to be interactive it should be deployed after the application has run and files are generated, whenever the user wants to view the reports. I decided to go with an applet based deployment, however I am not too happy with the current setup due to the following reasons:
I want to make the software as simple to use as possible (my users won't be tech-savvy, and even tech-intimidated in most cases). I would really like to distribute one JAR only, which forced me to put the applet with everything else it needs in a package in the same JAR as the main application.
The applet and the main application need to communicate the results, so I create a xML-based report which is used to hold information. As long as the files are on a local machine and are not moved around it all works fine. Unfortunately I also need the files to be moved around. A user should be able to take the "results" folder to a USB stick, go anywhere plug the stick to another computer and be able to use the report as he/she likes.
For the time being the applets are implemented with the following html code:
<applet code="package.myapp.visualization.GraphApplet.class"
codebase="file:/home/user/myApp"
archive="myApp-0.2.6-r28.jar"
width="750" height="750">
<param name=input value="results/test_name/results.fxml">
</applet>
As you can see this applet will not work if the parent folder is moved to another location.
As far as I know I have a couple of alternatives:
a) Change codebase to point to an URL on our webserver where I could put the jar file. This however creates the problem with permissions, as the applet will not be able to read the results file. Alternative is to upload the results file to the server when the user wants to visualize the graph, although I am not sure if that's a good option due to server security and also if it could be made so that upload happens automatically without bothering the user.
b) I can use a relative path on the codebase attribute, but then the whole folder hierarchy needs to be intact upon copy. This could be a last resort, if I cant come up with a better way to do it.
c) change the deployment method (would like to avoid this alternative to not spend more time on the development phase)
Any ideas? Am I missing something? How could I tackle this problem?
Thanks,
I'm not sure I entirely understand your use-case, but from what I do understand, I would suggest this:
Dump the applet for an application launched using Java Web Start. Have the JNLP file declare a file association for the fxml file type. When the user double clicks an fxml file, it will be passed as an argument to the main(String[]) of the JWS application.
A sand-boxed JWS application can gain access to resources on the local file system using the JNLP API. Here is my demo. of the JNLP API file services.
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