Upload File when Submit

QuestionsUpload File when Submit
Anand asked 7 years ago

Hi Abu,

I tried to upload xls file in FTP when submit after record added. But its not working.

Thank you,

4 Answers
Abu Ghufran answered 7 years ago

Please refer demos/editing/file-upload.php and see add_inivoice() callback function.

Anand answered 7 years ago

Hi Abu,
Thanks for the information. But here i need to use FTP function to upload the file to remote server. When we added one custom function and we called that function after custom event but ftp call not triggered, please find below ftp function which we used.

$ftp_server = "xxxxxx";
$ftp_conn = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
$login = ftp_login($ftp_conn, "*****", "******");

$file = "****.xls";

// upload file
if (ftp_put($ftp_conn, "***/****.xls", $file, FTP_ASCII))
{
echo "Successfully uploaded $file.";
}
else
{
echo "Error uploading $file.";
}

Can you please assist us how to trigger this FTP method.

Thanks,
Anand

Abu Ghufran answered 7 years ago

You can put this code in on_insert event handler and move uploaded file with your code.

Anand answered 7 years ago

Hi Abu,

Many Thanks for your help. The option you provided is working fine.

Thanks,
Anand.

Your Answer

16 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?