Home › Forums › Quform PHP › Multi File Uploads – Saving File Names Into DB
- This topic has 3 replies, 2 voices, and was last updated 8 years, 6 months ago by davidjwest.
- AuthorPosts
- May 12, 2016 at 11:46 am #18899davidjwestParticipant
Hi – first thanks for a great script, saved me a lot of work!
I am having trouble getting the file names saved using multi uploads.
1. The uploads are working OK, they are getting uploaded to the correct location.
2. The database script is working, it is saving the correct info etc.
But I cannot work out how to get the filenames to save.
This is my code:
(this is the form code, all uploads are called uploads[])
‘<div class=”quform-input-file”>
<input type=”file” name=”uploads[]” />
</div>’This is in process.php (my db field is called image)
‘$upload = $form->getValue(‘upload’);
$uploadUrl = isset($upload[0][‘url’]) ? $upload[0][‘url’] : ”;/* Step 3: configure the data to save */
$data = array(
‘title’ => $form->getValue(‘title’),
‘description’ => $form->getValue(‘description’),
‘category’ => $form->getValue(‘category’),
‘image’ => $uploadUrl,
);’I want all the image names in that field, ideally separated with a comma or something like that.
- This topic was modified 8 years, 6 months ago by davidjwest.
May 12, 2016 at 12:58 pm #18901davidjwestParticipantI have found a rather unorthodox solution, but my initial test seems to show it works.
I just added a line to your attachment code that sends the confirmation email:
‘
// Add any attachments
foreach ($attachments as $attachment) {
$mailer->addAttachment($attachment[‘path’], $attachment[‘filename’], ‘base64’, $attachment[‘type’]);$filenames = $filenames . $attachment[‘filename’] . “|”;
}
‘And then inserted that into the DB, I had to move your mailer code above the code that writes the data to the table so it had the value ready.
Just in case this helps anyone. Thanks.
(The pipe is what I am using the delimit the data)
- This reply was modified 8 years, 6 months ago by davidjwest.
May 15, 2016 at 10:12 pm #18907AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- This reply was modified 8 years, 6 months ago by Ally.
May 15, 2016 at 10:23 pm #18912davidjwestParticipantThanks – my solution is working but appreciate your time as your solution is more logical!
- AuthorPosts
- You must be logged in to reply to this topic.