Actually I'm doing Sample Application,
We are Observe many of social networks, in that Profile images are their, When ever mouse over it is asking Upload new Image.
So i want to Develop Same Application .
When ever we write <input type="file"/> then it is asking file and now add value(image) into .. So how to add this value.
Their is only one click browse image and upload image...
And now how to handle this one into Spring side..
Please Suggest me..
I thing you need to use ajax to do this. Click here to see a demo in PHP. They show how to done that in PHP. Instead of PHP you can use Spring with JSON to complete that.
Related
I am trying to write a java program that uses selenium to perform web actions. In the case of uploading a video there is a frame where the user clicks that brings up the File Explorer for Windows. I have not been able to find anything that will help me in getting the focus to the File Explorer to select a file. There is no "browse" on the page with a textbox for me to just send a filename to.
Here is what the page looks like:
I would try using Selenide because it has a pre-canned upload utility that might save you some time/effort. See the command .uploadFromClasspath in the docs. One of the project videos/pages shows a little more detail on how to do it.
I've not actually tried it, but if this works for you and you figure it out, please share.
What I have done in the past is to use the "Apache HttpUtils" class to simulate the upload action from my test. All you need is the upload URL, and the HTML page usually provides that. That might also work for you.
So I'm making a program for android that tries to download something from www.wupload.com. What I want isn't a browser but to interact with the webpage without actually showing it. Like how HtmlUnit is supposed to work.
I'm using apache for the html requests and what I've done so far is send a post that simulates clicking on slow download on the web page. Then I read the response so I can get some variables needed to make the next post and execute the next post. In theory, the web page should be showing the captcha cause the response I get is please enter the captcha, but no image url.
The next step would be to enter the captcha and finally download the file, the problem I'm having is I don't know how to show the captcha image to the user. Do I have to capture it somehow? I know how to make the post to send what the user would type, but the image url of the captcha isn't in the source code.
I thought of inspecting the web page so I could get the url from the DOM tree, like what inspect element on google chrome does, but I have no idea if it's even possible. Any ideas would be great.
thx
The captcha is probably generated using JavaScript. Therefore when you get the source of the website, the captcha hasn't yet been generated and you won't see the image in the source HTML. You would need to run the Javascript somehow. You could try using a WebView because it has built-in support for Javascript, or get a Javascript library for Java and use it somehow. I think it would be a lot of work.
Edit:
Actually, if they are using a thirdy-party captcha library, I'm sure it uses some sort of HTTP request system, so you might be able to inspect it with this plugin for Firefox.
I am working on a JSP project where the user needs to upload an image.
I need this image to be stored into the database so that it can be retrieved from the database later on. I need to show that image in the webpage itself as soon as the image has been loaded. I have tried several option like uploadbean, spring-3-mvc-fileupload-example.html, etc but nothing is working out for me.
Can you please give me a simple but effective way to do this? I am working with MySQL database.
Apurv I suggest you look at this library
http://commons.apache.org/fileupload/
The user guide is at http://commons.apache.org/fileupload/using.html
Try this one: http://commons.apache.org/fileupload/. It is simple and works fine. Although Spring also has wrapper for this component and I used it either directly or via Spring and both worked fine for me.
can i upload a file(image) without submitting the form..
Basically i want to create a webpage where a user can upload an image and preview it side by side but this should not submit my form.
i dont wanna use jquery
You can have two forms on the page. One to upload the image and other one for something else. Just don't nest them.
I've tried to implement this with AJAX but, if it's even possible, it would be a nasty hack. About the best you can do reasonably is to put the file upload form in an iframe, and after posting the file with AJAX, redraw the page with the image.
I think this is what you want But it uses PHP for sever side you can use what ever you want!
All you have to do is create a page which will handle the ajax call, which is saving the image and returning string "true" in case of succeeds. and for Java this (Handling Form-based File Upload with Java Servlet or JSP) should help you.
Check this one out ioncannon.net
You can try this .Also check
Here's I want to do, I want to upload a file that will be processed by a servlet. I would use Apache Commons - File Upload to handle the file to be uploaded.
I've seen the gmail-like AJAX file upload, where there would be a hidden iframe that would later be populated with a javascript to stop showing the upload image or displaying a message that the upload is succesful. However, this uses PHP, where the php file to handle the file upload would include the javascript inside the iframe.
My question is, how would I do this in Java using servlets, without resorting to JSP and imitating the above implementation on PHP. I don't even know if this is possible, so please guide me on a good implementation (without external libraries except for commons fileupload).
Note: I am aware that there are libraries out there that could do this easily, but I first want to know how this happens, how this is possible, and to dirty my hands and learn this.
Edit: Just to add, I would use the streaming API of Apache-Commons FileUpload
It is exactly the same.
The client makes an HTTP request to the server (by submitting a form).
The server responds with some HTML (which links to or embeds some JavaScript).
Switching from PHP to Java is just a drop in replacement. You don't need to change any of the JavaScript. The user guide tells you how to set it up.
http://oreilly.com/pub/a/javascript/2002/02/08/iframe.html is the best idea to file-upload. i done file upload using hidden iframe. Please consult with attached link.