Hi,
I made a form to upload a file from a blank page. It’s just a simple 1 field form to upload file to server.
I just add the validation where the maximum file allowed is 1MB, then I deployed to PROD environment.
But the the user wanted to change the maximum file size to 2,5MB. I changed it, and deployed it to PROD.
In development environment, I got no problem. But user can’t upload file with size >2MB. Every time they upload big file, the message says Success, and it’s saved in the table. But the file doesn’t go to server folder.
I see the generated file, and it’s the right code. I don’t know how to fix this, since there’s absolutely no error/warning message.
Here’s the code I use
$dat = $_FILES['uploadedfile']['name'];
$tmp_name=$_FILES['uploadedfile']['tmp_name'];
$target_dir = "E:/BACKUP/itsolution/detailtask/".[glo_task_code]."/";
$target_file = $target_dir.$dat;
$file_type = pathinfo($target_file, PATHINFO_EXTENSION);
$uploadOk = 1;
$err_alert = '';
if($dat == ''){
$err_alert = $err_alert."Please select file. ";
$uploadOk = 0;
}
//check file size > 2,5MB
if($_FILES['uploadedfile']['size'] > 2500000){
$err_alert = $err_alert. "Your file is too large.";
$uploadOk = 0;
}
if($uploadOk == 0){
return $err_alert;
}else{
if(!file_exists($target_dir)){
mkdir($target_dir);
}
move_uploaded_file($tmp_name,$target_file);
sc_exec_sql("insert into it_trn_task_dtl_attachs
(ITTRTADTLSID, ITTRTADTATHSFILENAME, ITTRTADTATHSPATH, CREATED_DATE, CREATED_USER)
values
('".[glo_task_dtl_id]."', '".$dat."', '".$target_dir."', ".sc_sql_protect(date('Y-m-d H:i:s'), 'date').", '".[glo_user_id]."')");
return "File imported successfully.";
}
And even though I set it to 3 MB, they still cannot upload file from PROD environment.