Find Jobs
Hire Freelancers

Contact Form 7 Form File Upload to FTP Servers Based on Dropdown Selection

$10-30 USD

処理中
投稿日: 約7年前

$10-30 USD

完了時にお支払い
I have a simple request form setup in Contact Form 7 with a dropdown selection of two facilities. There are two anonymous server addresses to upload files to based on which dropdown facility is selected. I have successfully added the following code to the [login to view URL] file, tested it and it works correctly for one of the dropdown selections. My problem is, I cannot get the code right for the other dropdown selection to upload and work correctly. The setup is the form part goes to a distributed email address and the file gets uploaded to the Anaheim or Orange FTP server. ftp**.[login to view URL] – Orange Facility ftp**.[login to view URL] – Anaheim Facility This only works for the Orange Facility. Now I can't seem to get the logic right for the 2nd code. I tried doing two separate functions (FacilityA and FacilityB) but I am stuck on how to take the "SelectAFacility" name and split it into 2 functions or write a conditional statement. Here is the code for the Contact Form 7: <label> Your Name (required) [text* your-name] </label> <label> Your Email (required) [email* your-email] </label> <label> Company [text your-company] </label> <label> Select A Facility </label> [select SelectAFacility "Anaheim|ftpuploadanaheim(at)[login to view URL] Orange|ftpuploadorange(at)[login to view URL]"] <label>Upload File [file your-file filetypes:pdf|txt|doc|docx|xls|xlsx|ppt|pptx|zip|tar|tgz|rar] </label> [submit "Send"] ______________________________________________________________________________________ Based on the dropdown selection, I tried to add a conditional statement to achieve this but it is not working and I need it done today. Here is the code with the conditional statement: function log_cf7($WPCF7_ContactForm) { $submission = WPCF7_Submission::get_instance(); $data = $submission->get_posted_data(); $uploadedFiles = $submission->uploaded_files(); $location = $data['SelectAFacility']; if (isset($uploadedFiles) && isset($uploadedFiles['your-file'])) { if ($location == 'Anaheim') { $ftp_server = "ftp**.[login to view URL]"; $ftp_username = "username A"; $ftp_userpass = "password B"; } elseif ($location == 'Orange') { $ftp_server = "ftp**.[login to view URL]"; $ftp_username = "username B"; $ftp_userpass = "password B"; } else { // do something exit(); } $ftp_conn = ftp_connect($ftp_server) or die("Could not connect to server"); $login = ftp_login($ftp_conn, $ftp_username, $ftp_userpass); $fileToUpload = $uploadedFiles['your-file']; $remotefile = $_FILES['your-file']['name']; if (ftp_put($ftp_conn, $remotefile, $fileToUpload, FTP_ASCII)) { //echo "Successfully uploaded $remotefile."; } else { // echo "Error uploading $fileToUpload."; } // close connection ftp_close($ftp_conn); } }
プロジェクト ID: 13894832

プロジェクトについて

6個の提案
リモートプロジェクト
アクティブ 7年前

お金を稼ぎたいですか?

Freelancerで入札する利点

予算と期間を設定してください
仕事で報酬を得る
提案をご説明ください
登録して仕事に入札するのは無料です
この仕事に6人のフリーランサーが、平均$51 USDで入札しています
ユーザーアバター
Hi we have wordpress expertise. The issue is identified. We can solve the issue. Can we take it further? Regards SAM
$55 USD 2日以内
4.8 (162 レビュー)
7.1
7.1
ユーザーアバター
i can do this and have a lot of review on it.... you can check my profile.......... ..........................................................
$35 USD 1日以内
4.7 (21 レビュー)
4.0
4.0

クライアントについて

UNITED STATESのフラグ
Bullhead City, United States
5.0
6
お支払い方法確認済み
メンバー登録日:1月 29, 2017

クライアント確認

ありがとうございます!無料クレジットを受け取るリンクをメールしました。
メールを送信中に問題が発生しました。もう一度お試しください。
登録ユーザー 投稿された仕事の合計
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
プレビューを読み込み中
位置情報へのアクセスが許可されました。
あなたのログインセッションの有効期限がきれ、ログアウトされました。もう一度ログインしてください。