Triggering a file when a file is uploaded in a ftp - ftp

i am just wondering is there any such feature available!
When user uploads file to a FTP once the connection is disconnected, FTP server need to trigger a event to start a program, so the program can work on the uploaded files.
Am i asking a features which is already available ?

The FTP program itself cannot execute a application, though you could try checking if the file is infact uploaded and then use PHP to execute the file you want.
I used it once for uploading and compiling a c# program.
Hope this helps, else further explain please.

Related

How to check whether a file downloaded from a ftp location is completed or not using apache camel

I need to check whether the file downloaded from a ftp location using camel is completed, being downloaded or the connection broke. If completed I need to do a certain function else I need to make another call
The FTP component also has the capabilities of File2. If you check the docs you'll see options for preMove, move, and moveFailed. You can change the names of files and/or change the location of files before processing, after successful processing, and after failure.

What is correct way for an FTP server to prevent corrupted uploaded files because of late append?

Using pureftpd I uploaded 1% of a 1276541542 byte file or about 15 megs. Then I killed the network connection abnormally to simulate a client getting kicked off their ISP. Then I waited an hour. Then I re-connected and issued an APPE (append) command and uploaded the rest of the file. The final size of the file on the server after the upload finished was 1292326238. i.e. about 15 megs MORE than it should be. Corrupt file. What is correct way for an FTP server to prevent corrupted uploaded files because of late append?
What is correct way for an FTP server to prevent corrupted uploaded files because of late append?
There is no way for the FTP server to prevent corrupted uploaded files because the server does not know what the file should be.
But the server can help the client to do a proper upload by implementing the SIZE command. Using this command the client can determine the current file size at the server and thus the position in the file where the upload should be continued. Of course this logic has to be implemented at the client.
i have pure-ftpd answers about it’s upload-script
i’m running pure-uploadscript --run /home/aa/done.rb —daemonize
and my done.rb program is
#!/usr/bin/env ruby
puts "done"
f=File.open("/home/aa/ddd.txt", "w")
f << "test"
f.close
and when I run pure-ftpd —uploadscript and upload a file, sure enough the done.rb program is run.
(I know it’s run cuz there is a new file called ddd.txt)
BUT when I’m uploading a big file and kill the ftp client in middle of upload done.rb is STILL run. (Yes I deleted ddd.txt first.)
Therefore, the answer to the question is, EVEN pureftpd can't handle this because of the limits of FTP protocol.

Poco FTPClientSession remote path

I'm attempting to write files to a server in my program. I'm using FTPClientSession, everything is going well, I have a session started, it's logged in with no errors, I have a file I know is on my local disk but it fails to send the data as I think the remote path for the location it's trying to write to is always wrong no matter what I try.
I don't really know what the path should be, if I right click on a directory within filezilla I will get something like
ftp://"username"#ftp."subdomain".vhostall.com/public_html/
is that what I use? Or would I use
www."subdomain".vhostall.com/public_html
or if the client session already knows the domain, should I just use
public_html
(none of these work by the way). I always get an error message wihin an exception "STOR command failed: 553 Can't open that file: No such file or directory"

how to delete file from the server after downloading it ?or how can i store the file to client machine directly from output stream?

am using liferay custom portlet and in that am using jasper report now my problem is that how can i download the pdf report directly on the client machine
right now am storing the file at server first.then provide url for downloading the pdf to user.but how can i directly store the file to client machine if i have pdf file's outputstream .
ot if i can know some how when user click on the download link and after downloading the file if i want to delete the donlowded file from the server then how can i do it.?if any one can guide me...
I'm not sure what you're asking for is possible, but I would be interested in seeing someone correct that statement though.
Servers really shouldn't be directly storing files on a client machine as that violates the intent of the client server relationship. A client has to make a request for the file and then the client can save that file (eg like a ftp download). Servers just don't manipulate client machines as they see fit.
As far as knowing when a file is downloaded, there isn't anything in a portlet you can do to detect that. You can use ResourceRequest and serveResource method to serve a file, but nothing in the portlet API will inform your portlet that the download is complete or that it wasn't interrupted by something.
As an alternative you might try simply having a cron job that will clean out old files. In this case, make sure to inform users how long they have to successfully download the file.

Syncing a file from a client to a server

I'm trying to keep a file updated real time with the server. Its more like a real time syncing which has a very small delay. Is there any application that lets me do this? Or would you suggest me using a local host as a server?
I dont know how you are connected to your server - but i assume this will be something like SCP / SFTP / FTP and i dont know your OS. WinSCP will do excatly this what you need, you can set it to watch your Filesystem (to a specified folder) and it will update the server files as soon as your file on your drive changes.
It also supports command line features so that you can use it within your own applications.

Resources