Commit 5623cdd6 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

file upload and validation working properly

parent 695af99e
......@@ -55,6 +55,8 @@ RUN sed -i 's/;error_log = log\/php7\/error.log/error_log = \/dev\/stderr/g' /et
sed -i 's/;opcache.max_wasted_percentage=5/opcache.max_wasted_percentage=5/g' /etc/php7/php.ini && \
sed -i 's/;opcache.validate_timestamps=1/opcache.validate_timestamps=1/g' /etc/php7/php.ini && \
sed -i 's/;opcache.revalidate_freq=2/opcache.revalidate_freq=300/g' /etc/php7/php.ini && \
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 30M/g' /etc/php/7.4/fpm/php.ini && \
sed -i 's/post_max_size = 8M/post_max_size = 30M/g' /etc/php/7.4/fpm/php.ini && \
echo "daemonize yes" >> /etc/redis.conf && \
ln -s /dev/null /var/log/nginx/access.log && \
ln -s /dev/stdout /var/log/nginx/error.log && \
......
......@@ -46,6 +46,8 @@ RUN sed -i 's/;error_log = log\/php7\/error.log/error_log = \/dev\/stderr/g' /et
sed -i 's/group = www-data/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php7/php.ini && \
sed -i 's/expose_php = On/expose_php = Off/g' /etc/php7/php.ini && \
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 30M/g' /etc/php7/php.ini && \
sed -i 's/post_max_size = 8M/post_max_size = 30M/g' /etc/php7/php.ini && \
sed -i 's/;zend_extension=xdebug.so/zend_extension=xdebug.so/g' /etc/php7/conf.d/xdebug.ini && \
echo "xdebug.remote_enable = 1" >> /etc/php7/conf.d/xdebug.ini && \
echo "xdebug.remote_autostart = 1" >> /etc/php7/conf.d/xdebug.ini && \
......
......@@ -29,14 +29,15 @@ class MailController extends Controller
# Wir benötigen 3 Felder von dem Benutzer wenn diese nicht übermittelt wurden, oder nicht korrekt sind geben wir einen Error zurück
$input_data = $request->all();
$maxFileSize = 5 * 1024 * 1024;
$maxFileSize = 5 * 1024;
$validator = Validator::make(
$input_data,
[
'email' => 'required|email',
'pcsrf' => ['required', 'string', new \App\Rules\PCSRF],
'attachments' => ['max:5'],
'attachments.*' => ['max:' . $maxFileSize],
'attachments.*' => ['file', 'max:' . $maxFileSize],
]
);
......@@ -65,6 +66,7 @@ class MailController extends Controller
$message = $request->input('message');
$subject = $request->input('subject');
$files = $request->file("attachments");
Mail::to($mailto)
->send(new Kontakt($name, $replyTo, $subject, $message, $files));
......
......@@ -4,7 +4,7 @@ server {
root /html/public;
index index.php index.html index.htm;
client_max_body_size 50M;
client_max_body_size 30M;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
......
......@@ -4,7 +4,7 @@ server {
root /html/public;
index index.php index.html index.htm;
client_max_body_size 50M;
client_max_body_size 30M;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
......
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Browser Test Suite">
<directory suffix="Test.php">./tests/Browser</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
</phpunit>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment