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.
Related
I am using Selenium and I need to upload an image to instagram. But at the time the windows file selector opens I could not get it to search for the image and upload it automatically
Up to this point my application opens well, when it goes to the point of selecting the file it does not do it automatically
I tried using the following codes without success
driver.findElement(By.className(name)).send_keys('C:\\path-to-file\\file.jpg')
But it gives me back the value of the second photo, that is, it generates a file selector from the main folder and not the one that I pass through as a parameter
I am using the following versions:
Java: 8
Selenium: 3.14
ChromeDriver: 76
Normal browsers don't allow JavaScript any access to the local disk. This is basic security. Imagine what would happen if you visit some site and it reads your local password file or any other important data without asking you.
If you want to upload files, take some standalone application or write a small utility that will do that. For instance, try instapy, you can find it pypi.org or on github. It is a matter of taste, the other can prefer other tools. Just try several tools and see which fits your need better.
The window opened for file explorer is not part of the browser and therefore it can not be interacted with via selenium. The solution to this is a software called AutoIt. Use the following link for a guide on how to use AutoIt for file uploads : Link
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.
I am using PD4ML to print a PDF file and It is working fine. Now the thing is I want show that file directly in acrobat with out save that file. In Local version I am using
Program.launch(getFilePath());
It is working fine but in web version I am unable to get that.
Can you please suggest me, Its very helpful.
Thanks,
Vara Kumar PJD
The web isn't like your desktop, so forget about doing things on the web the way you do them on the desktop without at least some effort.
Know that you don't read PDF files on the web using Acrobat without a browser plugin. Or some other reader like Foxit Reader.
My recommendation: forget about doing it this way. Either server your pdf as a file that can be downloaded, or read this SO post about embedding PDF in HTML.
I don't think this will be possible: "showing file outside browser in an application without user consent" because that is how browser are made for security reason. The best you can do is, as pointed in earlier post is by darioo, to show file in browser or prompt user to download/open.
I am working on an application which needs to preview privileged content in the browser. The preview should work in a way that its NOT possible to download the content. Only reading within the browser is allowed. I have looked at google docs preview but it needs the url of the docs to accessible online. I need to work with content in the intranet
The previewer should not mandate the installation of a pluggin as this would limit the access.
Any hints
Have a look at ImageMagick. If your're using, say, php, you could do something like
exec("convert -resize 500×800 {$file}.pdf {$file}.jpg");
and then display the resulting jpg-file on a webpage.
man convert should give you some further options.
I'm using a JTree to browse the content of a folder and I want that when a user click on a file, the software shows a preview of it (a screenshot of its first page).
The files are mostly Office documents and PDF.
I manage to do it for PDF file using a module downloaded from Sun, but I'd like to know if there is a way to do it using any software (JARs preferably) or even the built-in Windows API.
I was thinking of converting the file to PDF then do a preview of this PDF but this isn't optimal.
Any ideas ?
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 (the LGPL version)
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 had the same problem too and stumbled over this thread. Starting with the solution from Anthony I am using Libre Office in socket mode to convert office documents directly to a PNG. Unfortunately this isn't posible from PDF's. Here is a good overview which ways are possible.
unoconv --connection 'socket,host=127.0.0.1,port=2220,tcpNoDelay=1;urp;StarOffice.ComponentContext' -f png -e PageRange=1 your_file_name.extension
Little reference to start Libre Office in socket mode: click me
I asked this a long time ago: solution