turner2f Posted November 9, 2016 Report Posted November 9, 2016 How do we Limit the File Size and Restrict certain File types from Upload ? I did not see an option for this within the admin area . Quote
0 Michael Posted November 10, 2016 Report Posted November 10, 2016 in the server's php.ini file_uploads variable You can'r restrict file types just don't download them. ariq01 1 Quote
0 Blesta Addons Posted November 10, 2016 Report Posted November 10, 2016 if you want to use the UPLOAD class you can do like this a sample how to like this : // Load the pload components Loader::loadComponents($this, ["Upload"]); // Set the alloweded file types $this->Upload->setAllowedMimeTypes(['gif','png','pdf']); // Set the maximum file size $this->Upload->setMaxFileSize(2048); // size in bytes $this->Upload->setFiles($files, false); // the files list to upload $this->Upload->setUploadPath("/home/user/upload_directory/"); // the upload path directory // Will not overwrite existing file // And we will support the uploaded files are in $files['data'] $this->Upload->writeFile("data", false); // check if the upload was successfully if (!($errors = $this->Upload->errors())) { $this->Input->setErrors($errors); return; } Michael 1 Quote
0 turner2f Posted November 10, 2016 Author Report Posted November 10, 2016 @Blesta Addons 1) - Exactly which folder and file do I place this code ? 2) - And where within the file ( top, bottom, middle ) ? Quote // Load the pload components Loader::loadComponents($this, ["Upload"]); // Set the alloweded file types $this->Upload->setAllowedMimeTypes(['gif','png','pdf']); // Set the maximum file size $this->Upload->setMaxFileSize(2048); // size in bytes $this->Upload->setFiles($files, false); // the files list to upload $this->Upload->setUploadPath("/home/user/upload_directory/"); // the upload path directory // Will not overwrite existing file // And we will support the uploaded files are in $files['data'] $this->Upload->writeFile("data", false); // check if the upload was successfully if (!($errors = $this->Upload->errors())) { $this->Input->setErrors($errors); return; } Quote
0 Blesta Addons Posted November 10, 2016 Report Posted November 10, 2016 6 hours ago, turner2f said: @Blesta Addons 1) - Exactly which folder and file do I place this code ? 2) - And where within the file ( top, bottom, middle ) ? First where you want to use it ? you need to add this code in your plugin/module that your are coding it . Quote
0 turner2f Posted November 11, 2016 Author Report Posted November 11, 2016 I am needing this for the "Support Manager" function. For when people are submitting their support tickets. 1) - Exactly which folder and file do I place this code ? 2) - And where within the file ( top, bottom, middle ) ? Quote
Question
turner2f
How do we Limit the File Size and Restrict certain File types from Upload ?
I did not see an option for this within the admin area .
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.