Full Transcript

·YouTLDR

Tutorial Codeigniter 4 untuk Pemula | #12. Cara Upload Gambar di Codeigniter

26:10EnglishBy DirumahrafifTranscribed Jul 19, 2026
0:00

[Music]

0:01

A7X prohibits our womb will continue

0:04

yesterday in the previous video we have

0:06

discussed about how we can

0:09

validate for input yes

0:11

by using the features owned

0:14

by CodeIgniter well this time in

0:16

this video we will discuss

0:17

validation and also how we

0:20

can upload files

0:21

using the features owned by

0:23

CodeIgniter for friends who have not

0:25

watched the previous video about

0:27

wrong ties it is good to see first

0:30

for the video that we have previously

0:31

made because we will use the

0:34

previous form that we use there are two

0:37

files that we use this time the

0:38

bphp page is in the controllers directory section

0:40

then the validation form page

0:42

It is in the views directory

0:45

then in the inside of the

0:47

content directory sometimes the first we open

0:49

first for the validation form page

0:51

as we have previously

0:53

said it is in the

0:55

views directory section then in the inside

0:58

of the content directory we will

1:00

remove for is

1:01

so name name email password and

1:04

password confirmation yes now Let's try to

1:06

remove first for the

1:08

bottom part here yes we controles then

1:12

in the form action section we enter

1:15

because we will use the process of

1:16

uploading files yes we add it

1:19

in the form section with the type yes

1:22

multiparts form-data Eh then after

1:26

we enter for the type

1:27

hoe-taek multi-platform data will be

1:30

used to upload files,

1:32

so it must be determined Neng Tab

1:33

multi-platform data if for example

1:36

we have determined for multi-platform

1:38

data we enter it at the bottom

1:40

we Write the input aib Tab we

1:46

give the file then NEM we

1:49

give the image for example then we

1:53

will OS Now we go to

1:56

page 20 HP in the controllers section Hey

1:59

we go to the validation page function

2:01

yes Underscore form

2:03

underscore validation page we have

2:05

determined yesterday to carry out the

2:07

process yes There is a name then email

2:10

password and at the bottom there is a

2:12

password confirmation Well because in the

2:15

form section we did not use it for the name

2:17

email password and password confirmation

2:18

this is as a tablok first yes then we

2:22

pantless we just comment then we

2:25

will determine for the process of providing

2:27

new rules or rules if we are

2:30

now below yes still in the inside

2:32

of the rule variable we

2:35

enter for the new rule we

2:37

first determine for the field name that

2:39

we will use the name is image eh

2:42

then we enter brackets yes

2:45

it will be an array then

2:48

determined for the label label we

2:51

give the name label is image yes

2:54

then we enter for the rules that

2:57

we will use we write in the straight

2:59

then Pan

3:01

nah arrow yes then we enter the

3:04

First Russia we will use is

3:06

uploaded uploaded yes Well then in the

3:10

uploaded section we also

3:11

determine from which film it will be taken

3:13

it is in the image field section then we

3:16

write inside the brackets

3:18

this writing damba Okay then we will

3:21

OS then we add again at the

3:23

bottom of the rules yes we

3:26

give a comma then we write

3:29

errors have entered with

3:33

square brackets again then we need

3:36

for errors that will appear if

3:38

for example the rule is not met yes

3:41

here we write the formula is

3:42

uploaded then inside

3:44

this error we also enter uploaded

3:49

eh then we give

3:52

another arrow then we find for

3:54

the error if for example the rule is not

3:56

met we write Please enter

4:01

and then followed by

4:03

curly brackets Widya we write Fit like

4:06

this then it will follow

4:08

from the label that we specified in the

4:10

label section we need for the writing

4:12

from the field is image then it is

4:15

not a field yes pills y like this

4:20

then if for example it has been determined

4:22

for the rule now we scroll down to the

4:24

bottom let me

4:27

just remove it Okay then we will

4:31

enter it inside the validation

4:34

with this request if for example

4:35

the rule is met yes we enter it

4:38

at the bottom then we write it

4:40

inside from validation If

4:44

for example there is no error the

4:45

writing that we will use yes

4:48

For example the first we will enter

4:50

a variable first image for example

4:52

then in the inside of the

4:55

image directory we will Call

4:56

based on the request made

4:58

including Kandis arrow sign Rich

5:01

Yes arrow sign again then followed

5:05

by getfile head file yes get file

5:10

earlier in the get file section We determine from

5:14

where yes which input type will be

5:16

used yes According to the name

5:17

we have the name is image then the

5:20

writing is determined is image

5:22

generation Nia image head file the writing is

5:25

image according to the name in the

5:27

input part of our file type the writing is

5:30

image then we also enter in the

5:32

inside of get file earlier the writing

5:35

is image eh then try this

5:38

first we will issue

5:39

Actually what file name is entered

5:43

in the upload process

5:45

first we usually write Eko yes

5:48

then we write the name of the image file

5:51

colon images arrow sign get

5:59

Enim

6:01

Oh yes then we will tuh es because

6:04

Let's look at the browser section we

6:06

try to select the file first Cut file

6:08

then we search for the image

6:10

for example I choose the writing Bear this

6:12

for the image there are many I click on the

6:14

send data section yes he has

6:17

issued yes the name of the image file

6:18

the writing is bear dbg for the

6:21

file name try next we Add it

6:23

again for the next rules If

6:25

previously we entered to

6:26

upload now we add for the

6:28

next rules we give a five sign

6:30

like this then we enter

6:32

for the settings of the area for example

6:35

we enter for the settings of the

6:37

Maximum size we write Max

6:39

underscore size then enter

6:42

with a urong sign like this yes brackets

6:46

square brackets like this then we

6:48

determine beforehand for the field name

6:50

that we will use the name of the corner

6:52

is our image Write image

6:53

followed by a comma then followed

6:56

by the Maximum size allowed

6:58

if for example what we will determine

7:00

for the maximum

7:01

is five KB for example we write

7:03

five means five This is in

7:05

KB size yes Well next If

7:08

for example it has been determined for the rules

7:10

yes Maxim is typical we also determine

7:12

for the erotic part we give a comma

7:15

we add below yes Write

7:18

Max underscore size then followed

7:20

by an arrow easily followed by the

7:23

name of the writing to be determined

7:25

for example we enter the maximum size

7:30

is 5 kg for example like this

7:33

then we know es as Seen

7:36

Again in the browser section we choose

7:40

to Cut file yes then we choose

7:42

for the size of the bear earlier

7:45

our bear material has a size of 68 KB

7:48

it should issue a message yes if

7:50

for example the size is not met I

7:52

select in the Open section I click on the

7:55

send data section yes it has displayed

7:57

for the message the maximum size is

7:59

five KB Now let me

8:01

increase it so that it doesn't

8:03

issue an error, we

8:05

enter it in fishgod again, then

8:08

we determine that we have a size

8:09

of 68 KB, for example, I entered

8:13

the maximum is 1024, yes, or one

8:16

Mega, here I change one MB to one MB,

8:21

yes, then I city ice, we try to see the

8:23

browser rejuve section again, we

8:27

select the image, then I select the

8:29

send data section so it doesn't

8:32

display the error, it has

8:33

issued the name, yes, the name

8:35

is the image file, the writing is

8:38

bear, another bcbg from Maximum size We

8:41

can also determine for damage or

8:44

other rules, we add paip

8:46

first, then we enter for the

8:49

next rule, namely XT

8:51

underscore in, yes, it will be used to

8:54

determine what extensions are

8:56

allowed from the file we upload,

8:57

we enter eksstein then

9:01

square brackets then followed by the name of

9:03

the film, the note is the image, followed

9:06

by a comma, yes, then there we

9:08

determine

9:10

what extensions are allowed, for example,

9:12

only JPG is allowed, we

9:13

write JPG, yes, then at the

9:16

bottom we also enter for the

9:18

error display, yes, the error text,

9:20

if for example, this eksstein in the

9:23

rules section is not met, we write

9:25

extend-1 coreinn, then talk, we

9:29

enter for the error, if for example it is

9:31

not met for the rules are not

9:33

Write the allowed extension

9:38

is JPG then we know es

9:42

Let's look again in the browser section

9:45

then we try to juice our file choose

9:48

for another extension besides JPG

9:51

here we have PNG I choose bng by

9:56

clicking the Open section then I choose

9:59

send the

10:01

extension given is JPG arzed

10:04

has also done the process to

10:05

check that the extension

10:07

allowed is only for JPG there are

10:11

also those that we can directly

10:13

enter yes to determine that the

10:15

uploaded file is an image type yes

10:19

Tsubasa extension remove then I replace it

10:22

with is underscore image yes then

10:27

there we enter square brackets

10:29

then we determine for the

10:31

File name Fitri's name is an image eh

10:34

we control es then we add

10:36

below is underscore image

10:40

we just enter at the bottom the

10:42

error text if for example he is not an image

10:44

yes we enter for example the file that is

10:49

allowed is only an image yes then

10:53

we try to look again in

10:56

our browser section Juve again Then Let's

10:59

look for

11:01

another file for example we have this tarpaulin

11:04

type txt I choose I click the

11:07

send data section yes he will only

11:10

allow for images only

11:12

Then the error he displays the file

11:15

that is allowed is only an image there are also those

11:18

that we can enter to

11:20

determine the maximum dimensions

11:22

allowed yes Maxim dimension means the

11:24

length and also the width yes from

11:28

an image that we upload we

11:30

enter the P morning sign to separate

11:32

between must then we enter

11:34

there Max underscore games in the machine has

11:37

the dimensions then we enter from the

11:40

file that we have the name is

11:41

image followed by a comma then

11:44

followed by the length and also the width

11:47

of the image that we have for

11:48

the maximum for example we determine the quotient

11:51

looks like our image used to rain

11:54

Let's look at the image of

11:55

the bear Right Click then selected

12:00

properties

12:01

Hi then selected details there

12:04

the maximum is 640 then 480

12:07

pixels yes we give it for the rule

12:11

for example the maximum is 500 500 yes

12:13

I cancel first then I enter it

12:15

into the rus for the size of the

12:18

dimension 500,000 for example then

12:22

we Write for the error if

12:25

for example the rule from Maxim the dimension is

12:27

not met and enter Max dims

12:30

then followed by an arrow

12:32

then we Write for the error yes

12:35

For example we Write the maximum dimension

12:40

is 500 times Mar'atus for example maybe

12:45

we Torres as we enter it again

12:48

according to again Then select the

12:51

bear section I select the send data section

12:55

so It has displayed for the maximum

12:58

dimension allowed is 500k

13:00

500 Let's try

13:01

African settings again not 500 500

13:05

for example is 1024 then multiply

13:09

by 780 yes then we enter

13:13

for the error 1024 times 780 Ecoutez

13:18

I enter again in the browser section

13:21

I select the image by select the bear

13:24

then I Click on the send data section

13:26

yes he no longer displays for

13:28

the neck Now he has displayed

13:30

for the name of the image file that we uploaded

13:31

the name is bear bcbg Facebook

13:34

We have entered for the rules yes

13:36

There is a maximum image size then

13:39

the image that is allowed then Maxim

13:42

dimensions Coral we try the bottom slop and

13:45

we will make the settings from the

13:46

image that is allowed then

13:48

we will enter it into the directory

13:50

that we have yes we enter it

13:52

into validation with request district

13:54

West then this role yes we enter

13:57

at the bottom then there we

14:00

will try

14:01

from the image that we have and we

14:03

will move it into the directory that

14:05

we will determine the place yes

14:07

before we write first If Yes

14:11

then Rub inside

14:14

this image is the name of the variable that

14:17

we had then followed by the

14:19

arrow yes then we enter

14:22

isvalid this will determine that the image

14:26

that was uploaded Yes is valid if

14:28

for example it is like this then we

14:30

Add it again yes then we give an

14:33

exclamation mark we enter the Smurf image yes

14:39

this will determine whether the image has been

14:41

uploaded or not Smurf then

14:45

inside the

14:47

curly brackets we will enter it

14:49

to the directory that we will want

14:51

yes we enter the arrow image

14:56

then followed by young move

14:59

there we can determine

15:01

your location we will enter the image that

15:03

we will have this time we enter

15:06

move then followed by a period

15:10

then we determine the directory where

15:12

we will put our image for example

15:14

we enter upload yes then

15:16

given with the eh Slash sign then

15:21

there we enter the location or file

15:24

that we will use we enter it

15:26

finished like this then we

15:28

enter the image director yes then

15:31

we KTS now Let's try we will

15:34

enter it to the upload directory

15:36

then to the image directory later

15:38

the location will be like this yes he will

15:42

enter this public directory yes then

15:44

there he will immediately automatically

15:46

create a directory the name is upload

15:48

then inside the apple directory there

15:50

will be an image directory yes

15:53

now Let's make sure we select

15:56

in the Cut files section select bear

15:59

first bye-bye

16:01

Dian send data yes he has added the

16:04

image file name is bear.co.id

16:06

meaning he has no error now

16:08

Let's look at our gratitude section yes

16:12

he has added yes here for the

16:13

upload directory I click on the

16:15

directory about section there is a directory called

16:18

image then in it there is a file that has

16:20

just been written, the name is

16:22

bear dbg there is already a file bear

16:25

Gedebage if for example I upload it again

16:27

to the file from upload then

16:29

this image directory is the same file we

16:32

try to see what the results are like

16:33

we put it in the juice file section

16:36

then I select the bear section

16:38

again yes I select in the send data section

16:40

we try to see in the fishgod section he

16:44

adds one wheel Yes the writing

16:46

is bear underscore 1.gg he

16:50

immediately adds for the index

16:52

to be underscore one so if

16:54

for example I enter again for the

16:56

same file named bear to JPG y

17:00

then I click to

17:01

send data and Try to see again yes

17:04

add another file and given

17:07

another name yes bear underscore Two

17:09

earlier we had bear

17:11

underscore one but before the

17:12

earliest we had writing yes the file was

17:15

named bear.co.id immediately

17:17

added from this city it turns out and

17:19

he will add the index according

17:21

to what we have Well to

17:23

find out actually when in the

17:25

upload process What is

17:26

done we try the cap from the

17:29

previous writing eh then we enter it to the

17:33

bottom of this move then we

17:39

write the name of this image file is

17:42

the name of the previous image file then

17:43

if for example we want to know

17:45

what new image file name is

17:47

entered then we write at the

17:49

bottom the new image file name D2 yes

17:53

we try to see for the name change

17:55

yes now Let's look again we

17:58

Cut V again we select in the

18:01

space section again we select in the send

18:03

data section But before we entered the

18:05

image file name it displays the

18:08

dbg bear yes if for example I go around in the

18:10

send data section yes it displays the

18:12

initial DJ BG bear image file name

18:15

then this is the new one the

18:17

new image file name 3dcg underscore bear

18:20

so it is immediately soaked and the name

18:22

of the file that we uploaded has

18:25

also been determined by psychotic m We

18:27

actually we can also enter the

18:30

file name we want yes For example

18:32

I give a comma behind drawing

18:35

this move then we determine for the

18:38

style name we will use for example

18:40

I enter the image worthy of the Underscore

18:45

bear yes then I enter a dot

18:48

then I follow the dot again Then

18:51

I will find from the extension that

18:53

we uploaded we enter the arrow image

18:56

yet extension hehehe

19:01

it will enter the image with the

19:04

file name is me minus the image minus the

19:07

dot bear yes then followed by the

19:09

GT extension image yes we try to see

19:12

in the browser section we try to enter

19:15

again want a moment a I give a

19:17

break sign yes at the bottom replica

19:21

conflict so that There is a change and there is a gap

19:24

with the one at the top It can be seen

19:26

again in the browser section I Cut the file

19:29

then I select the bear image again

19:32

I select in the send data section yes Yes I

19:36

have determined the name of the

19:38

image file is a bear then the name of the new image

19:40

I draw a bear bcbg yes this or

19:42

the writing if we look at the

19:44

file section Yes I have entered yes the name

19:48

is I am a minus bear image.co.id

19:52

this is the name we determined in the

19:53

previous section actually we

19:56

can also determine the name of the file we

19:59

leave it to CodeIgniter

20:01

to provide the

20:03

desired name yes I try to

20:05

remove it for the image yes it says

20:09

For the move image just upload the

20:11

image then we will leave it yes

20:14

we will leave it to Coating l

20:16

whatever he gives the name What from the

20:18

image we upload we can

20:20

enter the arrow image then

20:22

we Write get rendem yes then

20:27

we if es Let's look at the

20:30

browser section we Cut V again we select the

20:33

bear yes then we Click on the

20:36

send data section the old original file

20:38

was actually a bear dbg but by

20:40

CodeIgniter it was changed to 1623

20:43

so and so then F3 dbg it will be

20:47

uploaded in the same place yes here it is

20:51

Enter the writing is 16263

20:54

9 if we see the image is

20:56

the Bear in the form section we

20:59

can only enter one file yes if

21:01

for example

21:01

cus file then I choose A2 the

21:04

business image can only choose one file

21:07

yes we will make it able to accept

21:10

for several files We determine in

21:12

our form section yes we just add

21:15

here for the type is file

21:17

then enter multiple multiple yes

21:22

so he can accept many files

21:24

then we enter the NEM with

21:27

square brackets too then we

21:29

will Torres Let's see in the

21:31

browser section yes Let me Refresh first yes

21:36

I Cut the file now for example I

21:38

select two images Yes it can accept

21:41

two images yes click the Open section

21:44

now I try to look in

21:46

our cottage section then we look in the

21:50

controllers section we will Try to

21:52

determine him so he can accept

21:55

for many files yes when we

21:57

upload the event How

22:00

to try this I

22:01

blog first yes then I comment

22:04

then I will enter at the

22:07

bottom we Write the file For example this

22:11

will capture for the files that we

22:12

upload we enter the USS district

22:18

then the Dead files arrow yes use

22:21

es yes get files he will capture all the

22:24

files that we upload then if

22:26

for example we have determined like this

22:27

we will repeat from the

22:31

uploaded yes we enter vorich eh

22:36

Parit then in for its we

22:38

enter the file for example what we will

22:42

get is from the image file yes we

22:45

enter the image file this is the name of

22:48

the file that we have the image in the

22:50

foundation section the writing is image yes

22:53

don't forget in the glue section we

22:55

give a ku sign elbow rung like this

22:58

then if for example we have

22:59

determined for the name is

23:01

far then we enter it in the

23:03

HP detail page section yes image file

23:06

then we will output the data yes

23:08

es image for example we because Es

23:12

now Let's try to do

23:14

a loop from the uploaded image

23:16

we just copy it from the top

23:19

here yes Let's just blog I blog

23:24

from the top and race Put it at the

23:26

bottom control es the comment I

23:30

remove yes he will run from the

23:33

previous command if the image is valid yes

23:35

according to the image is valid and then

23:38

here the typical image move he will be

23:40

moved for example we move it to

23:41

another place yes not upload image

23:44

for example I will move it to multiple

23:47

image yes I contest then if

23:50

for example the process is complete we

23:52

will move it to another location

23:55

yes by using set flashdata

23:59

fashion-fashion use

24:01

You go bracket yes season you hot set

24:06

flash data yes Res data we enter

24:11

success for example we give the writing

24:15

successful upload upload data yes then

24:22

we Christian Christian then we will

24:26

redirect him to the location redirect redirect

24:30

yes then we enter the arrow

24:33

deck yes then we Palace now

24:37

Let's look again in the fastest browser section

24:39

jus file we will specify two

24:43

files or one file first try I

24:48

enter two files yes then I

24:51

select in the Open section I click on the

24:53

send data section So there is a writing that says successfully

24:56

upload data now Let's see

24:57

if he has successfully entered it

24:59

into the multiple directory

25:01

so that Explorer clothing occurs then down

25:06

we look in the public section yes we have

25:09

an image here has directly created yes

25:10

for the director multiple images we

25:12

try to see yes he has entered for the

25:15

file yes this is entered

25:18

using g-tren.com image yes which is

25:21

determined by the psychotic liter he

25:23

has entered two images

25:25

Now what if for example I

25:26

will enter two files one

25:29

image but the other is not a file yes we

25:31

see yes I select the Suspect section again

25:35

Determine for the two files is text

25:38

data and also the next is

25:40

file.png then I select in the

25:43

Open section Click on the send data section it

25:47

displays an error message yes the file is

25:48

allowed only images because earlier

25:50

we entered one for the image

25:52

then the next We have

25:54

also entered for the file the form

25:56

is txt so it is not accepted by the

25:58

Coating meter that's how we

26:01

can

26:01

do the upload process yes from images

26:04

using CodeIgniter

26:05

Thank you during alaikum warahmatullahi

26:07

wabarakatuh

More transcripts

Explore other videos transcribed with YouTLDR.

Get the TLDR of any YouTube video

Process a new video with YouTLDR Pro — transcripts, summaries, translations, and repurposing in 125+ languages.

Get YouTLDR Pro — $12/month