Ajax upload a file from browser to FTP server - javascript

Is it possible to uplaod a file from browser to FTP server using ajax?

No. Browsers provide no APIs that allow writing to FTP from JavaScript.
You could post the file to an HTTP end point and then use server side code to push it to your FTP server.

Related

downloading file vs creating file on client side javascript

requirement - download a particular file on user action .
We can create files on client side using FILE API. So I am creating a file on client side from the data which is received from server so that user can download the file .
There is one more approach to do this that is getting file generated at server side and getting URL to the file instead of sending the file data.
I want to know which approach is better in terms of security and performance ? sending file data from server or sending a file URL from server?

Loading .html and .js with websockets

I have the idea of having something like a web server but without a web server. Instead I want to use websockets. Is for internal use.
The user will have a basic webpage which will only open a websocket connection and should receive an .html, and immediately navigate to it.
Also it should be able to load a .js with helper functions for this new html.
I saw here something to load an image file
http://liamkaufman.com/blog/2012/02/11/12-pushing-files-to-the-browser-using-deliveryjs-socketio-and-nodejs/
but I don't know how to navigate to a received .html file and how to execute a received .js file.
Do not try to convince me of using a webserver or other technologies, I have my reaasons for doing this :-)
Thanks
Using a websocket inherently means you need to use a server. A websocket is be definition a connection between the client and the server.
From here
WebSockets is an advanced technology that makes it possible to open an interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.
Regarding running a javascript file that you have downloaded, you can use eval, or you can create a new script tag on the body to load your javascript.

save image from remote server to local using javascript or jquery

I wanted to copy image from any remote server to my local server using javascript / jQuery. Please anyone help me out.
Same like copy() function in php.
Local server? JavaScript/Jquery runs in the client and they cannot access any files directly from a remote server. The client are mostly your browsers.
If you know the file path for your remote server and if your have access to it, you can just open the file using window.open("http://remoteserver/filename.jpg")
This would download the file to the client or your computer.

Upload files from mobile on server using jquery

I have a mobile application which needs the user to attach some files from his mobile and upload it on the server.
Is there a way to upload files on the server from mobile using JQUERY/JAVASCRIPT ?
I found many doin it with PHP/ASP.NET-c#...but my need is HTML with JAVASCRIPT/JQUERY...!!
FURTHER INFO ON MY APP (Kindly neglect it if not needed):
I have my front-end in HTML/CSS..I have a WCF service running on my server that does the communication with the database..I use the WCF service by making ajax calls from my client side..
I achieved all the other operations such as insert/delete/update/retrieve data from DB using these services only..
I was wondering if there is any possibility to do the "upload files on the server" task also using these webservices...but didnt get any idea about it !!!
Here is another question exactly precise to my need !! File upload service using WCF along with jquery(AJAX) and html client
Sorry if i m wrong anywhere..This stuff is totally new to me and so i need all your guidance..
To save an uploaded file, you need an server side script (PHP, ASP e.g.) to move the uploaded file from the servers tmp directory, to your desired location.
Maybe can you edit your serves configuration so it writes the uploaded files automatic to your desired location, but I wouldn't suggest that due to security reasons.
Is this a native application? If it's just a website then you'll struggle as safari on iPhone doesn't support file uploads. If it's a phonegap application you could maybe hook into the file API...
Ok some of the points worth mentioning.
When you wanted to upload file to server you have to POST file with multipart content type of the form. For this you might need to write WCF service on server end accordingly. I am not having good experience of WCF but this post should help may be
<form method="POST" enctype="multipart/form-data" >
HTML5 file API and XHR Level 2 specification you can upload files to server. As they are new features and JS and DOM involved yes you can consum and do it in JQuery as well as long as your browser is supporting them.
With these things i am not sure if there should be any issue while uploading files to the server.

How to ftp a file over to a server from PhoneGap/webapp?

Is it possible to connect to a server and FTP a file from within PhoneGap application? Basically I suppose - is there a way to open an FTP connection with Ajax/JQuery somehow?
I don't think you will be able to FTP a file from PhoneGap however they do provide an API for transferring a file to a server using HTTP multipart encoding:
http://docs.phonegap.com/en/1.0.0/phonegap_file_file.md.html#FileTransfer
You would need a script on the server in your chosen technology to receive the file however you should then be able to do whatever you like with it, including move it to the directory you are trying to FTP to
Ftp program for phone gap is here please see this bellow link.
https://github.com/macdonst/FtpClient

Categories

Resources