Download file, open it locally, edit and then upload - java

I have a web application that let users download files normally, and then later they can upload them using a simple upload mechanism (choose the files from directory and stuff).
Here's what I want to do: to have and "EDIT" button on my app, that download the file and open it automatically from the user's local drive. Then I want to check if there are changes, to upload it back to the server. Or, provide a way to the user upload it easily.
The options I've come so far, are:
Signed Applets
I find applets slow and "ugly". But it's the winning choice so far. It could download and open the file easily and then have an upload button, to put the file back on the server.
HTML 5 (File API)
I started looking into this and liked what I saw. But a lot of things that I saw are for local uploads, drag and drop and this kind of stuff. I'm very new to this technology and I simple don't know if it's doable.
A desktop application
I don't like this one but it's still on the table. It could one that monitors a directory created by an applet (here it's again), check if there are changes and then upload it back to the server.
Can someone provide me some help? If a can do something like that with HTML 5 or if there's a better solution.

You can't upload files without user interaction in HTML even if you try HTML5. That's against web fundemantals. The user has to trigger the file upload in a way, drag&drop, browse and select file, etc.
Signed applets might be a better solution than a desktop application because of the pain of the deployment.
If this file that you want your users to edit is just text based, I suggesst using an HTML based editor like Google does it for Google Docs.

Related

Looking for a way for a website to monitor a file on client side

I am developing a website which basically crunches numbers from data files and display statistics.
These data files are on the client hard drive and the client can upload them to the server via the HTML upload functionality.
This however requires the user to manually upload the files to update the statistics on the website.
I would like to know if there is a possibility for the website to automatically upload these files when they change. I can see the gapping security hole with skipping the user action, but is there a way for an user to share a specific directory from his drive with a website ?
I am looking for something very lightweight and easy to configure as the user is not supposed to have any IT knowledge.
I am using Play! framework and the user can be on any OS with any browser.
As you are saying yourself, there is no way to do this from a website for security reasons. Services that automatically share folders like, e.g, Dropbox does, do so by installing "real" applications client-side. I'd assume most users still consider this "lightweight" from their perspective, although it means more development work on your end. It also does not require significant IT knowledge.

Preselect files in JUpload

I have a requirement to process an external request to populate a HTML form with the parameters mentioned in the URL. This part is working fine. However, the URL also contains paths to files present on the client machine and I want to upload those files from the client machine to the server without user interaction.
Since it is not possible with HTML/Javascript to programatically select files, I tried using the Applet approach using JUpload. However, I am not able to figure out, how to preselect a file on applet initialization. It is not necessary to upload the files right away, but I want atleast to select the files automatically. User can review the info and then submit the form. and files in the applet.
Is it possible with this library? Or direct me to some better path
OK, so I found my answer in a different library with similar name. With Smartwerkz JUpload we can pass a parameter preselectedFiles="filePath" and autostartUpload=true to preselect files and auto upload files without user interaction. I hope it will help someone someday.

Applet for opening a file on a local machine but save in a cloud drive

I've seen an applet that will allow you to click on a file on a cloud drive (i.e on a web page), it then opens the file locally with the relevant app, and when you click save, the file is saved to the cloud drive.
I've tried searching for similar applets but can find nothing. Can anybody point me in the right direction.
This sounds like WebDAV functionality. Maybe something like "DAV Explorer" https://www.ics.uci.edu/~webdav/installation.html is what you want.
If not, try searching for other WebDAV applets.

BlazeDS/ FLEX - Upload an Image and Display

I'm working on a FLEX which enables the user navigate through a list of images at the server (BalzeDS tomcat 4.0.0.14931). The images stored under the "WebContent/Images", and the already available/ saved images are displayed as desired.
From this app user would be able to select a file from their local directory and upload it. I have done the necessary coding related with uploading the image and it successfully creates a copy at the desired folder at the server. Once the image file is uploaded I'm trying to display the it at the FLEX end, but the image is not displayed. When check at the target folder at the server end, the file has been created successfully.
In order to make the uploaded image visible, the BlazeDS Tomcat server has to be restarted. Since this is not desired way to go ahead, I am seeking some help from you experts out there to resolved this.
I tried searching the net get this issue sorted out, but unable to come cross any solution. An identical issue was posted on another forum (Tomcat restart problem), that also still not resolved.
I this is best approach to achieve this JAVA/ BlazeDS/ TomCat/ FLEX environment or is there a better alternative. The other alternative I could achieve this is through persisting the file into the database as byte[], but I did not want accomplish in that manner since size of the database tend to shoot up.
I would really appreciate if you could help me out on this.
Thanks in advance.
If you have to restart Tomcat, that means you are storing user data in your web-apps directory. You should not be storing any user data in the webapps folder. These are considered "system files" and should not be publicly editable under any circumstance.
Store any user data in a publicly accessible folder with the correct permissions and serve them over HTTP (you should be able to view it in a web browser).

Multiple file uploader with previews

I'm trying to find something that will let users upload multiple files to a website. The requirements are that it let them easily select multiple files (preferably with something like check boxes) and that it displays a preview of the images they select.
I'd prefer to only use Javascript or Flash if possible, but Java is also an option (this needs to work on platforms where Silverlight isn't available).
So far all I've been able to find are things that use the native file selector (which doesn't show previews on Windows, and makes it unclear that you can select multiple by holding ctrl).
I'm not sure if the preview requirement is even possible, but it's the most important.
This is a firefox solution:
It uses the FileReader javascript object to load, display and upload images.
http://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/
It still doesnt show previews in the FileSelection dialog but at least allows you to preview the images before uploading.
And here is a ready made java applet solution:
http://jumploader.com/doc_overview.html
To upload multiple files I use RichFaces rich:fileUpload component.
Concerning the preview, I've got the similar problem and the best I found after couple of days of googling is following.
Alfresco has the same problem and resolved it with :
An open office which runs in server mode (socket) and all the office documents are sent by alfresco to open office in order to convert them in PDF
Those PDF are converted to .swf viewer thanks to SWFTOOLS
This .swf is integrated in the HTML
For images, it uses ImageMagick to create small version of the file I suppose
Personnaly, I will try to implement it this way :
Converting office documents to PDF thanks to open office in socket mode
Transform the first page of the PDF into a PNG thanks to JPedal library
Diplay that PNG to the end user
For images I would perhaps use ImageMagick too ... but for now, I'm using Seam Image.scaleToFit API
I am assuming 2 things here:
1) Some kind of client/enduser will be doing the file upload
2) You get some kind of say on what the client installs on their computer to help make this happen.
If this is the case, my first suggestion would be:
Give them FTP or SFTP client software to upload files. The php page you make can have a link to Filezilla, along with instructions on how to use it. ftp and sftp are THE protocols to use for transferring files. HTTP is just not designed(well) for it, nor are browsers.
Once the user has the (S)FTP client software installed, you can give them URL's to upload files to that are specific to their user account, and you can have a backend script process and load/move files that they upload. It's pretty easy to create a local temporary directory using a server side script, have the client upload files via ftp, then go back to the web browser and click a button that says "Done uploading, please process my stuff".
The browser can even give back confirmations on everything that gets uploaded/processed.

Categories