"I want to upload an images to a directory from the URL(Link), But using only JavaScript. This URL can be of an image, PDF, audio, video or any kind of file. E.g, URL : http://bollywood-india-movie.com/sites/default/files/showtime_logo.png I want to upload this(URL Images) file to my Site's upload directory, but only using JavaScript. I tried to encode the file in base64 format.I am able to get a string in base64 but I am not able to understand how can I decode the string and store a file in upload directory. Is there any one with possible way can let me know how I can move further to do this? Please do let me know if there is any other possible way. Thanks in Advance!! "
You can't use javascript directly to upload a file - you still need to have some sort of server-side script to do the ACTUAL upload.
And again - javascript is run on the CLIENT - uploads and other stuff is run on the SERVER, and you need a background script, either PHP, Python, ASP - something, that will be able to talk to the file-system and upload the file. It is NOT POSSIBLE to upload anything in PURE javascript.
jQuery is javascript. Please understand the difference between running something on the client (the browser) and the server (Apache, IIS, whatever you're using). Unless you can use javascript to send the information to a handler script on the server, the file won't go anywhere.
There are tons of examples and tutorials if you only bothered to search http://lmgtfy.com/?q=ajax+image+upload like @PoPSiCLe said you still need a backend script to process the upload
I want to upload an images to a directory from the URL(Link) if i use PHP then the solution will not work on windows share hosting so need conman solution that is why i am looking for javascript or j query
Uhm - you cannot upload via AJAX alone - AJAX just talks to a server-side script. First off - why in the world do you use a Windows host? And if you need, for instance to be able to run ASP-pages, then just make the background process as an ASP-page instead of PHP? But almost every host out there support PHP, and there is no reason why a Windows based host (again, why?) shouldn't have it (although normally you have to have either / or). As I've tried to tell you at least a few times now - it's not possible - it's prohibited, and you won't find any way to do it - javascript is NOT supposed to be able to write directly to the server, for obvious reasons.
They are right, you need to actually have something (anything) on the server side to store/save(retrieve) the file. There are plugins/scripts/etc that could handle this if you use js to upload them. I once tried to write a banner exchange long ago using only javascript. I eventually realized that I no way to save the data or retrieve it! Sorry man.
As many people have said, @i_am_dhaval request is not technologically possible to upload or write files to a server with javascript alone (on LAMP or Windows environment). You'll need ASP or PHP files to handle placing the file on the server. Here's an example with code - http://stard.us.to/qa6v3fu
PHP is known to work very well in a windows server environment. In fact - you can download WAMP and have a full blown windows, apache, mysql, php server running in minutes - Now using IIS on an actual windows server - PHP can still be installed and configured, just like on a linux server. You absolutely 110% need a server side script to take the file and push it somewhere. AJAX can handle the transaction from URL to the script but you still need the final script to upload the file. No Jquery, No Javascript no nothing other than a server side language will work.