Home › Forums › Quform WordPress › File Upload Problem
- This topic has 2 replies, 2 voices, and was last updated 11 years, 5 months ago by lawrencepepper.
- AuthorPosts
- May 31, 2013 at 2:29 pm #4611lawrencepepperParticipant
Hello,
I have an update form setup which has a file upload field in it. When the form is submitted I have the values sent to a script which updates the row in a database.
In my functions file I have:
function updatepart_post_to_another_script($form)
{
// Rewrite the post variables
$post = array(
'description' => $_POST['iphorm_9_4'],
'detailed' => $_POST['iphorm_9_5'],
'notes' => $_POST['iphorm_9_17'],
'rnumber' => $_POST['iphorm_9_23'],
'manufacturer' => $_POST['iphorm_9_8'],
'mnumber' => $_POST['iphorm_9_9'],
'altmanufacturer' => $_POST['iphorm_9_10'],
'altnumber' => $_POST['iphorm_9_11'],
'file' => $_POST['iphorm_9_14'],
'fdescription' => $_POST['iphorm_9_18'],);
// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://www.mysite.com/scripts/update_part.php');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_9', 'updatepart_post_to_another_script', 10, 1);
The script that updates the database is:
<?php// Do Update
$con = mysql_connect("localhost","xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("edata", $con);
mysql_query("UPDATE part_record SET description='$_POST[description]', detailed_description='$_POST[detailed]', notes='$_POST[notes]', manufacturer='$_POST[manufacturer]', manufacturer_number='$_POST[mnumber]', alt_manufacturer='$_POST[altmanufacturer]', alt_number='$_POST[altnumber]', file='$_POST[file]', file_description='$_POST[fdescription]'
WHERE record_number='$_POST[rnumber]'");mysql_close($con);
?>
All fields get updated but the File field. If someone picks a file to upload the file gets uploaded, the file description gets updated but nothing get’s updated/inserted into the file field. I need the file name to be inserted into the file field. Any ideas?
Thanks
L
June 2, 2013 at 1:07 pm #4628AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
June 5, 2013 at 2:34 pm #4699lawrencepepperParticipantThanks.
Worked!
L
- AuthorPosts
- You must be logged in to reply to this topic.