I have a Multi part form on my Laravel page. When a file is submitted, I do get the file as attachment, but on the live (ubuntu/apache) server I do see that there is a path like /tmp/ghGg4Dr for the file, but no attachment. What can be the cause of this?
My code in the controller looks like:
if($file) {
$data = [
'body' => $body,
'from' => $email,
'to' => $settings['form-settings-to'],
'cc' => $settings['form-settings-cc'],
'subject'=> 'Form submission from ' . $_SERVER['HTTP_HOST'] . ': ' . $inputs['title'],
'file' => $inputs['file']
];
$send = Mail::send('emails.main', $data, function($message) use ($data) {
$message->to($data['to']);
$message->from($data['from']);
if($data['cc'] != '') {
$message->to($data['cc']);
}
$message->subject($data['subject']);
$message->attach($data['file']->getRealPath(), array(
'as' => 'file_' . date("Ymd_His") . '.' . $data['file']->getClientOriginalExtension(),
'mime' => $data['file']->getMimeType()));
});
}
Do I need to add some settings to the server?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2l807cU
via IFTTT
Aucun commentaire:
Enregistrer un commentaire