shobhitjain Posted November 15, 2009 Share Posted November 15, 2009 I need to Upload a single file to server folder. Just when i click on the button the script should send the image to the folder.The image path is described in the script.Please helpI am trying to make this thing in Javascript,Jquery or Ajax Link to comment Share on other sites More sharing options...
Synook Posted November 15, 2009 Share Posted November 15, 2009 You cannot automatically upload files from a client's filesystem - the user has to deliberately select that file. Link to comment Share on other sites More sharing options...
shobhitjain Posted November 15, 2009 Author Share Posted November 15, 2009 But i think that when we click on upload it just took the path of the file.Uploading is done when we click on submit.So if we mention the path of the file separately then after click it should upload...!!!!!!!!!!!!!!!Isn't it?????? Link to comment Share on other sites More sharing options...
shobhitjain Posted November 15, 2009 Author Share Posted November 15, 2009 Well i have found out the solution.here it is :i just need to change getElementByTagNameand typed there the fixed URL.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title></title><meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta http-equiv="imagetoolbar" content="false"><meta http-equiv="imagetoolbar" content="no"><script type="text/javascript" src="uploader.js"></script><script type="text/javascript">window.addEventListener("load", function() { // handle image preview var input = document.getElementById("photo"); // handle file upload var form = document.getElementsByTagName("form")[0]; var uploader = new Uploader(form); var uploadBtn = document.getElementById("upload"); uploadBtn.addEventListener("click", function() { uploader.send(); }, false);}, false);</script></head><body><form action="upload.php" method="post" enctype="multipart/form-data" onsubmit="return false;"> <fieldset> <input type="file" name="photo" id="photo"> <input type="submit" value="Upload" id="upload"> </fieldset></form></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.