I am trying to upload multiple images. I am using Codeigniter and I know there is a built in file upload class but I am just experimenting with my custom made image upload library. I have provided the code below.
The problem I am facing with the following code is it is just uploading only one (the one that is selected at last in the form) image.
Could you please kindly tell me where I am doing wrong?
My Controller:
function img_upload(){
$this->load->library('image_upload');
$image1= $this->image_upload->upload_image('imagefile1');
$image2= $this->image_upload->upload_image('imagefile2');
$image3= $this->image_upload->upload_image('imagefile3');
echo $image1 ."<br>"; echo $image2;
}
application/libraries/image_upload.php (Custom made library)
function upload_image($image_info){
$image=$_FILES[$image_info]['name'];
$filename = stripslashes($image);
$extension = $this->getExtension($filename);
$extension = strtolower($extension);
$image_name=time().'.'.$extension;
$newname="support/images/products/".$image_name;
$uploaded = move_uploaded_file($_FILES[$image_info]['tmp_name'], $newname);
if($uploaded) {return $image_name; } else {return FALSE;}
}
My Form
<form id="myForm" enctype="multipart/form-data"
action="<?php echo base_url();?>add/img_upload" method="post" name="myForm">
<input type="file" name="imagefile1" size="20" /><br>
<input type="file" name="imagefile2" size="20" /><br>
<input type="file" name="imagefile3" size="20" /><br>
<br /><br />
<input type="submit" value="upload" />
</form>
you can create some kind of rollback functionality and use CI native lib . it's little extra work for the server but it's less/clean/easyTOdebug code and it works .
function do_upload()
{
1 - configuration
$config['upload_path'] = './uploads/';
// other configurations
$this->load->library('upload', $config);
$error = array('stat'=>0 , 'reason'=>'' ;
2- uploading
if ( ! $this->upload->do_upload('file_1'))
{
$error['stat'] = 1 ;
$error['reason'] = $this->upload->display_errors() ;
}
else
{ $uploaded_array[] = $uploaded_file_name ; }
// you may need to clean and re initialize library before new upload
if ( ! $this->upload->do_upload('file_2'))
{
$error['stat'] = 1 ;
$error['reason'] = $this->upload->display_errors() ;
}
else
{ $uploaded_array[] = $uploaded_file_name ; }
3 - checking for errors and rollback at the end
if($error['stat'] == 1 )
{
$upload_path = './upload/';
if(!empty($uploaded_array))
{
foreach( $uploaded_array as $uploaded )
{
$file = $upload_path.$uploaded;
if(is_file($file))
unlink($file);
}
}
echo 'there was a problem : '.$error['reason'];
}
else
{
echo 'success';
}
}
I have found the solution to my problem, and thought it could help someone if I share.
The problem was in the image_upload.php file (custom made library), specifically in this line:
$image_name=time().'.'.$extension; //
time() was perhaps overwriting the files. So I replaced my previous code with the following:
function upload_image($image_info){
$image=$_FILES[$image_info]['name'];
$filename = stripslashes($image);
$extension = $this->getExtension($filename);
$extension = strtolower($extension);
$image_name=$this->get_random_number().'.'.$extension;
$newname="support/images/products/".$image_name;
$uploaded = move_uploaded_file($_FILES[$image_info]['tmp_name'], $newname);
if($uploaded) {return $image_name; } else {return FALSE;}
}
function get_random_number(){
$today = date('YmdHi');
$startDate = date('YmdHi', strtotime('-10 days'));
$range = $today - $startDate;
$rand1 = rand(0, $range);
$rand2 = rand(0, 600000);
return $value=($rand1+$rand2);
}
Related
So here is my front code:
<form action="" method="post">
<input type="file" name="image" class="input">
</form>
and the controller:
$upload_image = $_FILES['image']['name'];
if ($upload_image) {
$config['allowed_types'] = 'xml|docx|jpg|png|pdf|xlsx';
$config['max_size'] = '999999';
$config['upload_path'] = './assets/img/image/';
$this->load->library('upload', $config);
if ($this->upload->do_upload('image')) {
$new_image = $this->upload->data('file_name');
$this->db->set('image', $new_image);
} else {
echo $this->upload->display_errors();
}
}
in the $config the prog know the types of file that just inputted, like img docx and the other, how i can get the file types that just inputted as $types?
If you are asking how to get the file type of a file just submitted that's easy you only have to use
<?php
$types = $_FILE['file']['type'];
?>
pathinfo is an array. We can check directory name, file name, extension, etc.
$path_parts = pathinfo('test.png');
echo $path_parts['extension'], "\n";
echo $path_parts['dirname'], "\n";
echo $path_parts['basename'], "\n";
echo $path_parts['filename'], "\n";
https://www.php.net/manual/en/function.pathinfo.php
$judul = $_POST['judul'];
$idKategori = $_POST['kategori'];
$idPropinsi = $_POST['propinsi'];
$img = $_FILES['img']['name'];
$img_tmp = $_FILES['img']['tmp_name'];
$idUser = $_POST['user'];
$isi = $_POST['isi'];
$date = $_POST['date'];
if(empty($img)) {
$query = mysql_query("INSERT INTO `artikel`(`idArtikel`, `idKategori`, `idPropinsi`, `judul`, `idUser`, `isi`, `date`) VALUES ('','$idKategori','$idPropinsi','$judul','$idUser','$isi','$date')");
}else{
if(move_uploaded_file($img_tmp,"../../../img/".$img)) {
$query = mysql_query("INSERT INTO `artikel`(`idArtikel`, `idKategori`, `idPropinsi`, `judul`, `img`, `idUser`, `isi`, `date`) VALUES ('','$idKategori','$idPropinsi','$judul','$img','$idUser','$isi','$date')");
}else{
echo "Failed to upload image";
}
}
if($query) {
header("location:../../index.php?page=artikel");
}else{
echo "failed to update this post";
}
But the result is
move_uploaded_file(http://localhost/mvc/kuliner/assets/img/Green Nature Wallpapers 04.jpg): failed to open stream: HTTP wrapper does not support writeable connections
No!
Basically rewriting this code to work with Codeigniter is a lot more work than writing it from scratch using examples found in the CI documentation. Link provided in comment above (http://www.codeigniter.com/userguide2/libraries/file_uploading.html).
There are several reasons as both file upload, redirection, database handling, user output etcetera are done differently in CI using CI's methods and the MVC structure of programming.
This is how I do my uploads in CI (Using Dropzone).
Create Dropzone Controller
class Dropzone extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper(array('url','html','form'));
}
public function upload() {
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$temp = $_FILES["file"]["name"];
$path_parts = pathinfo($temp);
$t = preg_replace('/\s+/', '', microtime());
$fileName = $path_parts['filename']. $t . '.' . $path_parts['extension'];
$targetPath = UPLOADPATH;
$targetFile = $targetPath . $fileName ;
echo $fileName;
move_uploaded_file($tempFile, $targetFile);
// if you want to save in db,where here
// with out model just for example
// $this->load->database(); // load database
// $this->db->insert('file_table',array('file_name' => $fileName));
}
}
}
// Usage : <form action="<?php echo site_url('/dropzone/upload');" class="dropzone" >
/* End of file dropzone.js */
/* Location: ./application/controllers/dropzone.php */
Secondly Add the following HTML, (mainly to a form so as to submit file name
<div id="upload" class="form-group">
<label>Drop file Here</label>
<input type="hidden" id="file" name="file"/>
<div
class="dropzone"
id="uploadFile"><!--uploadFile is the dropzone name-->
</div>
</div>
Then a little Js to do the magic
Dropzone.options.uploadFile = {
paramName: "file", // The name that will be used to transfer the file
url:"<?php echo site_url('/dropzone/upload');?>",
maxFiles:1,
acceptedFiles:'image/*,application/pdf,.docx,.doc,.xls,.xlsx,.csv',
dictMaxFilesExceeded:"You can only upload one file per Response",
init: function() {
this.on("sending", function(file) {
// $('button#submit').attr('disabled','');// Requires Jquery
});
this.on("complete", function(file) {
//$('button#submit').removeAttr('disabled'); // Requires JQuery
});
this.on("success", function(file,xhr) {
//$('input[type="hidden"]#file').val(xhr); // Requires Jquery
});
}
};
Remember to include dropzone.js and jquery.js if needed.
You can upload files using the PHP function. But at first, you should make the directory or folder by yourself.
Here is my code, I did not add the validation part. I have created the uploads folder in the root directory.
$file = $_FILES['verfication_image'];
$file_name_with_extenstion = $file['name'];
$file_name = pathinfo($file_name_with_extenstion, PATHINFO_FILENAME);
$extension = pathinfo($file_name_with_extenstion, PATHINFO_EXTENSION);
$file_tmp_location =$_FILES['verfication_image']['tmp_name'];
$upload_name = $file_name.time().".$extension";
if(move_uploaded_file($file_tmp_location,"uploads/".$upload_name)){
echo "The file has been uploaded.";
}else{
echo "There was an error.";
}
I would suggest using the Codeigniter version of uploading the file as it is simple to add validation. I have added my Codeigniter code with validation,
$file = $_FILES['verfication_image'];
$file_name_with_extenstion = $file['name'];
$file_name = pathinfo($file_name_with_extenstion, PATHINFO_FILENAME);
$extension = pathinfo($file_name_with_extenstion, PATHINFO_EXTENSION);
$upload_name = $file_name.time().".$extension";
$config['upload_path'] = 'uploads/';
$config['file_name'] = $upload_name;
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 1024;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);//Load the libary with the configuration
if(!$this->upload->do_upload('verfication_image')){
echo($this->upload->display_errors());//validation error will be printed
}else{
echo "The file has been uploaded.";
}
For more details, please follow the official guideline File Uploading class
I've written a code to upload and unzip a zip file of images to a folder. This file is upload2.php, there is also an upload1.php which I use to input the folder name.
I'm trying to add a function wherein the script will also, after unzipping the files and saving them into the target folder, convert them into thumbnails and then ALSO save those thumbnails into another folder.
The script is also INSERTing various data about all the separate files into a mysql database.
Here's the code:
<?php // actual code for upload
$dirname = trim($_POST['dirname']);
$taken = trim($_POST['taken']);
$location = trim($_POST['location']);
$subject = trim($_POST['subject']);
$rooturl = "http://example.com/test";
$dateurl = $dirname.'/';
$mainurl = $rooturl.$dateurl;
require_once 'connect.php';
$sqlselect = "SELECT * from learning2 WHERE location='test2';";
$result = mysql_query($sqlselect) or die(mysql_error());
$thumbwidth = 100;
$thumbheight = 100;
function makeThumbnail($sourcefile, $endfile, $thumbwidth, $thumbheight, $quality) {
ini_set( "memory_limit","192M");
// Takes the sourcefile (path/to/image.jpg) and makes a thumbnail from it
// and places it at endfile (path/to/thumb.jpg).
// Load image and get image size.
if (file_exists($sourcefile)) {
$img = imagecreatefromjpeg($sourcefile);
$width = imagesx( $img );
$height = imagesy( $img );
if ($width > $height) {
$newwidth = $thumbwidth;
$divisor = $width / $thumbwidth;
$newheight = floor( $height / $divisor);
} else {
$newheight = $thumbheight;
$divisor = $height / $thumbheight;
$newwidth = floor( $width / $divisor );
}
// Create a new temporary image.
$tmpimg = imagecreatetruecolor( $newwidth, $newheight );
// Copy and resize old image into new image.
imagecopyresampled( $tmpimg, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height );
// Save thumbnail into a file.
imagejpeg( $tmpimg, $endfile, $quality);
// release the memory
imagedestroy($tmpimg);
imagedestroy($img);
} else {
echo "The file " . $sourcefile . " does not exist";
}
}
function makeDirectory($dirname) { //This function makes both the directory the photos will be unzipped into, and a directory nested within that for the thumbnails of those photos.
mkdir($dirname, 0777);
mkdir($dirname.'/thumbs', 0777);
}
if(isset($_POST['submit'])) {
if (file_exists($dirname) && is_dir($dirname)) { // determines whether or not this particular directory exists
echo "the directory exists and it is called: " . $mainurl;
echo "<br />";
} else {
makeDirectory($dirname);
}
if($_FILES["zip_file"]["name"]) { // pull the name of the zip file from the upload
$filename = $_FILES["zip_file"]["name"];
$source = $_FILES["zip_file"]["tmp_name"];
$type = $_FILES["zip_file"]["type"];
$name = explode(".", $filename); //format the filename for a variable
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
foreach($accepted_types as $mime_type) {
if($mime_type == $type) {
$okay = true;
break;
}
}
$continue = strtolower($name[1]) == 'zip' ? true : false; // let user know if the zip file has not been uploaded
if(!$continue) {
$message = "The file you are trying to upload is not a .zip file. Please try again.";
}
$target_path = $dirname."/".$name; // get the $target_path variable to for the move_uploaded_file() function.
if(move_uploaded_file($source, $target_path)) { // this block extracts the zip files and moves them to the $dirname directory
$zip = new ZipArchive();
$x = $zip->open($target_path);
if ($x === true) {
$zip->extractTo($dirname."/");
$images = array();
for ($i=0; $i<$zip->numFiles; $i++) {
$images[] = $zip->getNameIndex($i);
}
$zip->close();
unlink($target_path);
}
$message = "Your .zip file was uploaded and unpacked.";
}
} else {
$message = "There was a problem with the upload. Please try again.";
}
$newdir = scandir($dirname);
foreach ($newdir as $key => $value) {
if ($value!='.' && $value!='..') {
$thumburl = $rooturl.$dateurl.'thumbs/'.$value;
echo 'Key: ' . "$key;" . ' Value: ' . "$value" ."<br />\n";
$sourcefile = $value;
$endfile = 'http://example.com/test/'.$dirname.'/thumbs/'.'$value';
makeThumbnail($sourcefile, $endfile, $thumbwidth, $thumbheight, $quality);
mysql_query("INSERT INTO learning3 (taken, location, subject, rooturl, dateurl, imagename, thumburl) VALUES ('$taken', '$location', '$subject', '$rooturl', '$dateurl', '$value', '$thumburl')");
echo "<br />";
echo '<img src="'.$thumburl.'>< /img>';
echo "$value"." inserted successfully!";
} else {
echo $value." not inserted, thumbnail not created.";
echo $insert_sql . '<BR>' . mysql_error();
}
}
} else { echo 'Please input your data and select a zip file.';
}
echo '<html>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
if($message) echo "<p>$message</p>";
if($taken) echo "<p>pictures taken on: " . $taken . "</br>";
if($subject) echo "<p>subject: " . $subject . "</br>";
if($location) echo "<p>location: " . $location . "</br>";
if(($rooturl) && ($dateurl)) echo "<p>directory is called: " . $rooturl.$dateurl. "</br>";
?>
<form enctype="multipart/form-data" method="post" action="upload2.php">
<label for="dirname">Directory to use?: </label> <input name="dirname" size="20" type="text" value="<?php echo $dirname; ?>" /><br />
<label for="taken">When was this taken?:</label> <input name="taken" size="20" type="text" value="<?php echo $dirname; ?>" /><br />
<label for="location">Where was this taken?</label> <input name="location" size="20" type="text" /><br />
<label for="subject">subject?</label> <input name="subject" size="20" type="text" /><br />
<!--< />-->
<input type=hidden name="mainurl" value="<?php echo "http://example.com/test/".'$dirname;' ?>" />
<label>Choose a zip file to upload: <input type="file" name="zip_file" /></label>
<br />
<input type=submit name='submit' value="Upload" />
</form>
</body>
</html>
The thing I can't figure out about the script is this: it does not create the thumbnails and put them into the new thumbnail folder, although it does create the correct folders, and the mysql inserts are successful. Rather than the thumbnails being saved, I get the simple error messsage "the file does not exist." The thing is, I know the file does exist, because the earlier part of the script creates it. Can anyone tell me what I'm doing wrong here, or even give me a hint as to where I should be looking?
So, I tested the makeThumbnail() function directly (both with files in the current directory and then with files outside of it) and in both cases, it worked fine. It's kinda hard to know exactly what's going on without being able to fully execute the code, but my guess is that it lies in the call to makeThumbnail(). Is it possible that you're forgetting to prepend the path to $sourcefile before making the call? Is it possible there are white spaces at the beginning or end of $sourcefile? The function works, so it has to be the calling code that's responsible.
Just skimming that code, shouldn't the call be: makeThumbnail($dirname.$sourcefile[...]) instead of makeThumbnail($sourcefile[...]) (or "$dirname/$sourcefile", but you get the point)?
I used the Codeigniter's Upload Class to upload images to a folder in the project. In the database I only store the the url generated after upload the image, so when I want to delete a row in the db I also need to delete the image. How can I do it in codeigniter?
I will be grateful for your answers.
You can delete all the files in a given path, for example in the uploads folder, using this deleteFiles() function which could be in one of your models:
$path = $_SERVER['DOCUMENT_ROOT'].'/uploads/';
function deleteFiles($path){
$files = glob($path.'*'); // get all file names
foreach($files as $file){ // iterate files
if(is_file($file))
unlink($file); // delete file
//echo $file.'file deleted';
}
}
delete_row_from_db(); unlink('/path/to/file');
/path/to/file must be real path.
For eg :
if your folder is like this htp://example.com/uploads
$path = realpath(APPPATH . '../uploads');
APPPATH = path to the application folder.
Its working...
if(isset($_FILES['image']) && $_FILES['image']['name'] != '')
{
$config['upload_path'] = './upload/image';
$config['allowed_types'] = 'jpeg|jpg|png';
$config['file_name'] = base64_encode("" . mt_rand());
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload('image'))
{
$error = array('error' => $this->upload->display_errors());
$this->session->set_flashdata('msg', 'We had an error trying. Unable upload image');
}
else
{
$image_data = $this->upload->data();
#unlink("./upload/image/".$_POST['prev_image']);
$testData['image'] = $image_data['file_name'];
}
}
$m_img_real= $_SERVER['DOCUMENT_ROOT'].'/images/shop/real_images/'.$data['settings']->shop_now;
$m_img_thumbs = $_SERVER['DOCUMENT_ROOT'].'/images/shop/thumbs/'.$data['settings']->shop_now;
if (file_exists($m_img_real) && file_exists($m_img_thumbs))
{
unlink($m_img_real);
unlink($m_img_thumbs);
}
View:
<input type="file" name="new_file" data-required="1" class="" />
<input type="hidden" name="old_file" value="echo your old file name"/>
<input type="submit" name="submit"/>
Controller:
function edit_image() {
if(isset($_FILES['new_file']['name']) && $_FILES['new_file']['name'] != '') {
move_uploaded_file($_FILES['new_file']['tmp_name'],'./public_html/banner/'.$_FILES['new_file']['name']);
$upload = $_FILES['new_file']['name'];
$name = $post['old_file'];
#unlink("./public_html/banner/".$name);
}
else {
$upload = $post['old_file'];
}
}
Try using delete_files('path') function offered by CI framework itself:
https://ellislab.com/codeigniter/user-guide/helpers/file_helper.html
$image_data = $this->upload->data();
unlink($image_data['full_path']);
This line $this->upload->data() will return many information about uploaded file. You can print information and work accordingly.
I've built a rather straightforward file uploader in PHP. So far I've had no troubles uploading images and zip files. However, I can't seem to upload .mpg's. Whenever I try then it after hanging for a moment the page seems like it didn't try to upload anything at all. For example: this
// This is also manually set in php.ini
ini_set("upload_max_filesize", "524288000");
...
print_r($_FILES);
print_r($_POST); // I'm sending along one variable in addition to the file
returns nothing but empty arrays. For completeness, here's the front-end
<form action="uploadVideo.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="524288000"/>
<input type="hidden" name="extravar" value="value" />
<p>
<label for="file">Filename:</label>
<input type="file" name="file" id="file" /><br />
<i>Accepted formats: .mp4, .3gp, .wmv, .mpeg and .mpg. Cannot exceed 500MB.</i>
</p>
<p>Description:</p>
<textarea name="description" rows="4" cols="40"></textarea>
<p><input type="submit" name="submit" value="Submit" /></p>
</form>
The file I am testing with is only 33MB and I tested a .wmv of similar size and it uploaded just fine.
Edit: Entire PHP file listed below
<?php
// Ensure that the user can upload up to the maximum size
ini_set("upload_max_filesize", "524288000");
ini_set("post_max_size", "524288000");
print_r($_POST);
print_r($_FILES);
if(!$link = mysql_connect($SERVER_LOCATION, $DB_USER, $DB_PASS)) die("Error connecting to server.");
mysql_select_db($DB_NAME);
$eventID = $_POST['event'];
// Select the event this is associated with
$query = "SELECT eventName FROM event WHERE eventID = $eventID";
if(!$res = mysql_query($query, $link)) die("Error communicating with database.");
$path = mysql_fetch_row($res);
$path = "media/$path[0]";
// If this event doesn't have a media folder, make one
if(!file_exists($path)) {
mkdir($path);
}
// If this event doesn't have a GIS subfolder, make one
$path = "$path/videos";
if(!file_exists($path)) {
mkdir($path);
}
// Generate todays date and a random number for the new filename
$today = getdate();
$seed = $today['seconds'] * $today['minutes'];
srand($seed);
$random = rand(0, 999);
$today = $today['mon']."-".$today['mday']."-".$today['year'];
$fileType = $_FILES["file"]["type"];
$fileExtension = pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION);
$isMP4 = ($fileType == "video/mp4" && $fileExtension == "mp4");
$isWMV = ($fileType == "video/x-ms-wmv" && $fileExtension == "wmv");
$isMPG = ($fileType == "video/mpeg" && ($fileExtension == "mpeg" || $fileExtension == "mpg"));
$is3GP = ($fileType == "video/3gp" && $fileExtension == "3gp");
$sizeIsOK = ($_FILES["file"]["size"] < 524288000);
if( ($isMP4 || $isWMV || $isMPG || $is3GP) && $sizeIsOK ) {
if($_FILES["file"]["error"] > 0) {
echo "<p>There was a problem with your file. Please check that you submitted a valid .zip or .mxd file.</p>";
echo "<p>If this error continues, contact a system administrator.</p>";
die();
} else {
// Ensure that the file get's a unique name
$filename = $today . "-" . $random . "." . $fileExtension;
while(file_exists("$path/$filename")) {
$random = rand(0, 999);
$filename = $today . "-" . $random . "." . $fileExtension;
}
move_uploaded_file($_FILES["file"]["tmp_name"], "$path/$filename");
$description = $_POST['description'];
$query = "INSERT INTO media (eventID,FileName,File,filetype,Description) VALUES ($eventID,'$filename','$path','video','$description')";
if(!$res = mysql_query($query, $link))
echo "<p>Error storing file description. Please contact a system administrator.</p>";
else {
echo "<h3>File: <i>".$_FILES["file"]["name"]."</i></h3>";
if(strlen($description) > 0) {
echo "<h3>Description: <i>".$description."</i></h3>";
}
echo "<p><strong>Upload Complete</strong></p>";
}
echo "<button onclick=\"setTimeout(history.go(-1), '1000000')\">Go Back</button>";
}
} else {
echo "<p>There was a problem with your file. Please check that you submitted a valid .zip or .mxd file.</p>";
echo "<p>If this error continues, contact a system administrator.</p>";
}
?>
You cannot adjust the file upload limits using ini_set() from within the script that the uploads go to - the script does not get executed until after the upload is completed, so the ini_set() overrides cannot take place. The default parameters in PHP will be in place with the lower limit, and will kill the upload if it exceeds the system upload_max_filesize.
You need to override at the .ini level in PHP, or via a php_value directive in a .htaccess file. Those will change PHP's settings as the upload starts.
Ok, the first thing i thougt would be a problem with the filesize but other files with this size are working as you wrote.
But just do get shure it isn't a file size problem:
When you rise the max filesize you hmust also rise the max post size: post_max_size