Contact Form 7 Form File Upload to FTP Servers Based on Dropdown Selection - 25/05/2017 12:36 EDT - open to bidding

已关闭 已发布的 6 年前 货到付款
已关闭 货到付款

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);

}

}

JavaScript Node.js 编程 SQL WordPress

项目ID: #14157927

关于项目

37个方案 远程项目 活跃的6 年前

有37名威客正在参与此工作的竞标,均价$165/小时

sapotacorp

Hello bullheadcityweb!. Im a full stack developer, i can help you do this task fast. i have already charged a reasonable price. Please hire me!Thank you!

$180 USD 在5天内
(852条评论)
8.4
sweta2317

I can help can we discuss? are you able to send me the ftp to check this code live in progress? we can work now. thanks

$64USD 在1天里
(397条评论)
8.2
niravvirani17

Ready to do your job now Please give me job, i will give you best and fast work. just give me chance and will approve my work ability.

$147 USD 在3天内
(522条评论)
7.9
dungnguyen2607

Hello. I'm ready to start your project now. Thank you very much .

$222 USD 在5天内
(107条评论)
6.6
Dezinestar

According to my understanding you are unable to get value of $data['SelectAFacility'] correctly for applying it under condition. Right?

$77USD 在1天里
(20条评论)
5.7
keithn

Hello, I just took a quick glance at the code, when you try running the version modified for either server, neither works? But when set for just Orange, it works? I should be able to get this working quickly for 更多

$70 USD 在3天内
(20条评论)
5.4
OneStopTech

we have best server setup team

$194 USD 在3天内
(39条评论)
4.9
arksong123

Hi, I am a serious developer who aims to provide high quality services. If you contact me, we can discuss more things detail and will be achieved with each other's purpose. Good luck for your business…

$155 USD 在2天内
(12条评论)
4.4
BeautiCG

Hi,dear. I am a senior software developer. I have just checked your project report, I am able to perform this task with my developer team. I am looking forward to your proposal...

$155USD 在1天里
(9条评论)
3.3
thatsjusme

Hi, Thanks for the code I have reviewed the code and I am ready to fix it . Please let me know when I can Start working? Looking forward to hear from you. Thanks Rohit

$100 USD 在0天内
(8条评论)
2.8
phpdevelopers020

Greetings! My name is Amit Kumar and I am an expert in web development. I would love to have the opportunity to discuss your project with you. I believe my skills are good enough to match your project. I have a good 更多

$150 USD 在3天内
(5条评论)
2.8
ShoebMonty

I have 4 year experience in PHP and wordpress development . I am capable enough to build php web application with full security and code reusability.

$55USD 在1天里
(6条评论)
2.4
chetanmeniya

I am PHP developer. I have 4 years of experience in web development. I have experience in PH PHP,mysql,html,css. looking forward to work with you.

$100 USD 在2天内
(1条评论)
0.4
parthdesai88

Hello there, We have gone through your specified requirement and according to which you want to develop a code for your requirements. We can definitely help you in this task. I think for this development you will 更多

$222 USD 在15天内
(0条评论)
0.0
techcrunch2

Hello Sir, We have gone through the details you have provided and we have already worked on a similar project before and can deliver as u have mentioned and would be pleased to work on this with you to deliver the resu 更多

$207 USD 在6天内
(0条评论)
0.0