1 Attachment(s)
How to upload a file by clicking a link instead of button?
:cool:
I need an way to upload a file by clicking a link instead of button(<input type="file" name="somename"/>). This feature has been newly added to GMail, to attached a file we need to click a link.
Any ideas or code of how this can be done are needed.
Thanks
Re: file upload by clicking a link instead of button
Welcoem to Java programming forums.
This is a Java Forum....not a html/php/javascript forum.
Maybe it redirects you to a page with an upload script on it?
Chris
Re: file upload by clicking a link instead of button
Hello raghuprasad,
Chris is right, this is a Java forum, not a JavaScript forum. The two languages are different.
I think I can help you with this one though regardless..
If you were to do this with JavaScript, all you need to do is add a 'onclick' to the href link which calls the desired function.
For example, create the upload function and put it on your page:
Code :
<SCRIPT language="JavaScript">
<!--hide
function upload()
{
//upload code here
}
//-->
</SCRIPT>
Then on your href link:
Code :
<a href="javascript:upload()">Attach an image</a>
When the 'Attach an image' link is clicked, the upload function is called.
Do a Google search on how to upload files using Javascript
javascript upload file - Google Search