Skip to content

Commit 03eb13a

Browse files
author
Fredrick Peter
committed
update
1 parent 1e2b019 commit 03eb13a

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ $file = TameFile();
114114
| config | Assoc `array` | Create all needed config data |
115115
| class | Assoc `array` | Create error and success class |
116116

117-
```config
117+
```config
118118
config_file(
119119
message: [
120120
'401' => 'Select file to upload',

src/File.php

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ public function validate($closure = null)
8282
$this->proceedToValidate();
8383

8484
if(!$this->success){
85-
$this->callback($closure);
85+
if(in_array($this->getStatus(), [401, 402, 403, 404, 405])){
86+
$this->callback($closure);
87+
}
8688
}
8789

8890
return $this;
@@ -259,7 +261,7 @@ public function folder($folder)
259261
* Set Structure Creation
260262
*
261263
* @param string $structure
262-
* - Keys [default, year, month, day]
264+
* - [default, year, month, day]
263265
*
264266
* @return $this
265267
*/
@@ -274,7 +276,7 @@ public function structure($structure)
274276
* Upload size in mb
275277
*
276278
* @param int|string $size
277-
* [optional] Default is (2mb)
279+
* - [optional] Default is (2mb)
278280
*
279281
* @return $this
280282
*/
@@ -306,8 +308,8 @@ public function limit($limit)
306308
* Set width
307309
*
308310
* @param int|string $width
309-
* @param bool $width - Default is `true`
310-
* [optional] Set to false will make size equal to or greather than
311+
* @param bool $actual
312+
* - [optional] Set to false will make size equal to or greather than
311313
*
312314
* @return $this
313315
*/
@@ -325,8 +327,8 @@ public function width($width, ?bool $actual = true)
325327
* Set Height
326328
*
327329
* @param int|string $height
328-
* @param bool $width - Default is `true`
329-
* [optional] Set to false will make size equal to or greather than
330+
* @param bool $actual
331+
* - [optional] Set to false will make size equal to or greather than
330332
*
331333
* @return $this
332334
*/
@@ -344,8 +346,7 @@ public function height($height, ?bool $actual = true)
344346
* Set Mime Type
345347
*
346348
* @param string $mime
347-
* [available keys]
348-
* - video|audio|file|image|general_image|general_media|general_file
349+
* - [video|audio|file|image|general_image|general_media|general_file]
349350
*
350351
* @return $this
351352
*/
@@ -474,18 +475,18 @@ public function form()
474475
/**
475476
* Unlink File from Server
476477
*
477-
* @param string $fileToUnlink
478-
* @param string|null $checkFile
479-
* [optional] File to check against before unlinking
478+
* @param string $pathToFile
479+
* - [base path will be automatically added]
480+
*
481+
* @param string|null $fileName
482+
* - [optional] file name. <avatar.png>
483+
* - File to check against before unlinking
480484
*
481485
* @return void
482486
*/
483-
static public function unlink(string $fileToUnlink, $checkFile = null)
487+
static public function unlink(string $pathToFile, $fileName = null)
484488
{
485-
Tame::unlinkFile(
486-
base_path($fileToUnlink),
487-
$checkFile
488-
);
489+
Tame::unlink($pathToFile, $fileName);
489490
}
490491

491492
/**

src/helpers.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ function TameFile($name = null)
2323
* Global Configuration
2424
*
2525
* @param array $message
26+
* - [401|402|403|404|405|405x|200|kb|mb|gb|and|width|height|files|file]
27+
*
2628
* @param array $config
29+
* - [limit|size|mime|baseDir|driver|structure|generate]
30+
*
2731
* @param array $class
32+
* - [error|success]
2833
*
2934
* @return void
3035
*/

tests/index1.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ class: [
2020
// [optional] closure/callable function,
2121
// When using `save()` and `validate()` method.
2222
$upload = File::name('avatar')
23+
// ->folder('upload/transaction')
2324
->size('500kb')
2425
->save(function($response){
2526

2627
$response
2728
->watermark('tests/watermark.png', 'bottom-right')
28-
->resize(690, 540)
29+
// ->resize(690, 540)
2930
->compress();
3031
});
3132

0 commit comments

Comments
 (0)