Tutorial Codeigniter 4 untuk Pemula | #12. Cara Upload Gambar di Codeigniter
[Music]
A7X prohibits our womb will continue
yesterday in the previous video we have
discussed about how we can
validate for input yes
by using the features owned
by CodeIgniter well this time in
this video we will discuss
validation and also how we
can upload files
using the features owned by
CodeIgniter for friends who have not
watched the previous video about
wrong ties it is good to see first
for the video that we have previously
made because we will use the
previous form that we use there are two
files that we use this time the
bphp page is in the controllers directory section
then the validation form page
It is in the views directory
then in the inside of the
content directory sometimes the first we open
first for the validation form page
as we have previously
said it is in the
views directory section then in the inside
of the content directory we will
remove for is
so name name email password and
password confirmation yes now Let's try to
remove first for the
bottom part here yes we controles then
in the form action section we enter
because we will use the process of
uploading files yes we add it
in the form section with the type yes
multiparts form-data Eh then after
we enter for the type
hoe-taek multi-platform data will be
used to upload files,
so it must be determined Neng Tab
multi-platform data if for example
we have determined for multi-platform
data we enter it at the bottom
we Write the input aib Tab we
give the file then NEM we
give the image for example then we
will OS Now we go to
page 20 HP in the controllers section Hey
we go to the validation page function
yes Underscore form
underscore validation page we have
determined yesterday to carry out the
process yes There is a name then email
password and at the bottom there is a
password confirmation Well because in the
form section we did not use it for the name
email password and password confirmation
this is as a tablok first yes then we
pantless we just comment then we
will determine for the process of providing
new rules or rules if we are
now below yes still in the inside
of the rule variable we
enter for the new rule we
first determine for the field name that
we will use the name is image eh
then we enter brackets yes
it will be an array then
determined for the label label we
give the name label is image yes
then we enter for the rules that
we will use we write in the straight
then Pan
nah arrow yes then we enter the
First Russia we will use is
uploaded uploaded yes Well then in the
uploaded section we also
determine from which film it will be taken
it is in the image field section then we
write inside the brackets
this writing damba Okay then we will
OS then we add again at the
bottom of the rules yes we
give a comma then we write
errors have entered with
square brackets again then we need
for errors that will appear if
for example the rule is not met yes
here we write the formula is
uploaded then inside
this error we also enter uploaded
eh then we give
another arrow then we find for
the error if for example the rule is not
met we write Please enter
and then followed by
curly brackets Widya we write Fit like
this then it will follow
from the label that we specified in the
label section we need for the writing
from the field is image then it is
not a field yes pills y like this
then if for example it has been determined
for the rule now we scroll down to the
bottom let me
just remove it Okay then we will
enter it inside the validation
with this request if for example
the rule is met yes we enter it
at the bottom then we write it
inside from validation If
for example there is no error the
writing that we will use yes
For example the first we will enter
a variable first image for example
then in the inside of the
image directory we will Call
based on the request made
including Kandis arrow sign Rich
Yes arrow sign again then followed
by getfile head file yes get file
earlier in the get file section We determine from
where yes which input type will be
used yes According to the name
we have the name is image then the
writing is determined is image
generation Nia image head file the writing is
image according to the name in the
input part of our file type the writing is
image then we also enter in the
inside of get file earlier the writing
is image eh then try this
first we will issue
Actually what file name is entered
in the upload process
first we usually write Eko yes
then we write the name of the image file
colon images arrow sign get
Enim
Oh yes then we will tuh es because
Let's look at the browser section we
try to select the file first Cut file
then we search for the image
for example I choose the writing Bear this
for the image there are many I click on the
send data section yes he has
issued yes the name of the image file
the writing is bear dbg for the
file name try next we Add it
again for the next rules If
previously we entered to
upload now we add for the
next rules we give a five sign
like this then we enter
for the settings of the area for example
we enter for the settings of the
Maximum size we write Max
underscore size then enter
with a urong sign like this yes brackets
square brackets like this then we
determine beforehand for the field name
that we will use the name of the corner
is our image Write image
followed by a comma then followed
by the Maximum size allowed
if for example what we will determine
for the maximum
is five KB for example we write
five means five This is in
KB size yes Well next If
for example it has been determined for the rules
yes Maxim is typical we also determine
for the erotic part we give a comma
we add below yes Write
Max underscore size then followed
by an arrow easily followed by the
name of the writing to be determined
for example we enter the maximum size
is 5 kg for example like this
then we know es as Seen
Again in the browser section we choose
to Cut file yes then we choose
for the size of the bear earlier
our bear material has a size of 68 KB
it should issue a message yes if
for example the size is not met I
select in the Open section I click on the
send data section yes it has displayed
for the message the maximum size is
five KB Now let me
increase it so that it doesn't
issue an error, we
enter it in fishgod again, then
we determine that we have a size
of 68 KB, for example, I entered
the maximum is 1024, yes, or one
Mega, here I change one MB to one MB,
yes, then I city ice, we try to see the
browser rejuve section again, we
select the image, then I select the
send data section so it doesn't
display the error, it has
issued the name, yes, the name
is the image file, the writing is
bear, another bcbg from Maximum size We
can also determine for damage or
other rules, we add paip
first, then we enter for the
next rule, namely XT
underscore in, yes, it will be used to
determine what extensions are
allowed from the file we upload,
we enter eksstein then
square brackets then followed by the name of
the film, the note is the image, followed
by a comma, yes, then there we
determine
what extensions are allowed, for example,
only JPG is allowed, we
write JPG, yes, then at the
bottom we also enter for the
error display, yes, the error text,
if for example, this eksstein in the
rules section is not met, we write
extend-1 coreinn, then talk, we
enter for the error, if for example it is
not met for the rules are not
Write the allowed extension
is JPG then we know es
Let's look again in the browser section
then we try to juice our file choose
for another extension besides JPG
here we have PNG I choose bng by
clicking the Open section then I choose
send the
extension given is JPG arzed
has also done the process to
check that the extension
allowed is only for JPG there are
also those that we can directly
enter yes to determine that the
uploaded file is an image type yes
Tsubasa extension remove then I replace it
with is underscore image yes then
there we enter square brackets
then we determine for the
File name Fitri's name is an image eh
we control es then we add
below is underscore image
we just enter at the bottom the
error text if for example he is not an image
yes we enter for example the file that is
allowed is only an image yes then
we try to look again in
our browser section Juve again Then Let's
look for
another file for example we have this tarpaulin
type txt I choose I click the
send data section yes he will only
allow for images only
Then the error he displays the file
that is allowed is only an image there are also those
that we can enter to
determine the maximum dimensions
allowed yes Maxim dimension means the
length and also the width yes from
an image that we upload we
enter the P morning sign to separate
between must then we enter
there Max underscore games in the machine has
the dimensions then we enter from the
file that we have the name is
image followed by a comma then
followed by the length and also the width
of the image that we have for
the maximum for example we determine the quotient
looks like our image used to rain
Let's look at the image of
the bear Right Click then selected
properties
Hi then selected details there
the maximum is 640 then 480
pixels yes we give it for the rule
for example the maximum is 500 500 yes
I cancel first then I enter it
into the rus for the size of the
dimension 500,000 for example then
we Write for the error if
for example the rule from Maxim the dimension is
not met and enter Max dims
then followed by an arrow
then we Write for the error yes
For example we Write the maximum dimension
is 500 times Mar'atus for example maybe
we Torres as we enter it again
according to again Then select the
bear section I select the send data section
so It has displayed for the maximum
dimension allowed is 500k
500 Let's try
African settings again not 500 500
for example is 1024 then multiply
by 780 yes then we enter
for the error 1024 times 780 Ecoutez
I enter again in the browser section
I select the image by select the bear
then I Click on the send data section
yes he no longer displays for
the neck Now he has displayed
for the name of the image file that we uploaded
the name is bear bcbg Facebook
We have entered for the rules yes
There is a maximum image size then
the image that is allowed then Maxim
dimensions Coral we try the bottom slop and
we will make the settings from the
image that is allowed then
we will enter it into the directory
that we have yes we enter it
into validation with request district
West then this role yes we enter
at the bottom then there we
will try
from the image that we have and we
will move it into the directory that
we will determine the place yes
before we write first If Yes
then Rub inside
this image is the name of the variable that
we had then followed by the
arrow yes then we enter
isvalid this will determine that the image
that was uploaded Yes is valid if
for example it is like this then we
Add it again yes then we give an
exclamation mark we enter the Smurf image yes
this will determine whether the image has been
uploaded or not Smurf then
inside the
curly brackets we will enter it
to the directory that we will want
yes we enter the arrow image
then followed by young move
there we can determine
your location we will enter the image that
we will have this time we enter
move then followed by a period
then we determine the directory where
we will put our image for example
we enter upload yes then
given with the eh Slash sign then
there we enter the location or file
that we will use we enter it
finished like this then we
enter the image director yes then
we KTS now Let's try we will
enter it to the upload directory
then to the image directory later
the location will be like this yes he will
enter this public directory yes then
there he will immediately automatically
create a directory the name is upload
then inside the apple directory there
will be an image directory yes
now Let's make sure we select
in the Cut files section select bear
first bye-bye
Dian send data yes he has added the
image file name is bear.co.id
meaning he has no error now
Let's look at our gratitude section yes
he has added yes here for the
upload directory I click on the
directory about section there is a directory called
image then in it there is a file that has
just been written, the name is
bear dbg there is already a file bear
Gedebage if for example I upload it again
to the file from upload then
this image directory is the same file we
try to see what the results are like
we put it in the juice file section
then I select the bear section
again yes I select in the send data section
we try to see in the fishgod section he
adds one wheel Yes the writing
is bear underscore 1.gg he
immediately adds for the index
to be underscore one so if
for example I enter again for the
same file named bear to JPG y
then I click to
send data and Try to see again yes
add another file and given
another name yes bear underscore Two
earlier we had bear
underscore one but before the
earliest we had writing yes the file was
named bear.co.id immediately
added from this city it turns out and
he will add the index according
to what we have Well to
find out actually when in the
upload process What is
done we try the cap from the
previous writing eh then we enter it to the
bottom of this move then we
write the name of this image file is
the name of the previous image file then
if for example we want to know
what new image file name is
entered then we write at the
bottom the new image file name D2 yes
we try to see for the name change
yes now Let's look again we
Cut V again we select in the
space section again we select in the send
data section But before we entered the
image file name it displays the
dbg bear yes if for example I go around in the
send data section yes it displays the
initial DJ BG bear image file name
then this is the new one the
new image file name 3dcg underscore bear
so it is immediately soaked and the name
of the file that we uploaded has
also been determined by psychotic m We
actually we can also enter the
file name we want yes For example
I give a comma behind drawing
this move then we determine for the
style name we will use for example
I enter the image worthy of the Underscore
bear yes then I enter a dot
then I follow the dot again Then
I will find from the extension that
we uploaded we enter the arrow image
yet extension hehehe
it will enter the image with the
file name is me minus the image minus the
dot bear yes then followed by the
GT extension image yes we try to see
in the browser section we try to enter
again want a moment a I give a
break sign yes at the bottom replica
conflict so that There is a change and there is a gap
with the one at the top It can be seen
again in the browser section I Cut the file
then I select the bear image again
I select in the send data section yes Yes I
have determined the name of the
image file is a bear then the name of the new image
I draw a bear bcbg yes this or
the writing if we look at the
file section Yes I have entered yes the name
is I am a minus bear image.co.id
this is the name we determined in the
previous section actually we
can also determine the name of the file we
leave it to CodeIgniter
to provide the
desired name yes I try to
remove it for the image yes it says
For the move image just upload the
image then we will leave it yes
we will leave it to Coating l
whatever he gives the name What from the
image we upload we can
enter the arrow image then
we Write get rendem yes then
we if es Let's look at the
browser section we Cut V again we select the
bear yes then we Click on the
send data section the old original file
was actually a bear dbg but by
CodeIgniter it was changed to 1623
so and so then F3 dbg it will be
uploaded in the same place yes here it is
Enter the writing is 16263
9 if we see the image is
the Bear in the form section we
can only enter one file yes if
for example
cus file then I choose A2 the
business image can only choose one file
yes we will make it able to accept
for several files We determine in
our form section yes we just add
here for the type is file
then enter multiple multiple yes
so he can accept many files
then we enter the NEM with
square brackets too then we
will Torres Let's see in the
browser section yes Let me Refresh first yes
I Cut the file now for example I
select two images Yes it can accept
two images yes click the Open section
now I try to look in
our cottage section then we look in the
controllers section we will Try to
determine him so he can accept
for many files yes when we
upload the event How
to try this I
blog first yes then I comment
then I will enter at the
bottom we Write the file For example this
will capture for the files that we
upload we enter the USS district
then the Dead files arrow yes use
es yes get files he will capture all the
files that we upload then if
for example we have determined like this
we will repeat from the
uploaded yes we enter vorich eh
Parit then in for its we
enter the file for example what we will
get is from the image file yes we
enter the image file this is the name of
the file that we have the image in the
foundation section the writing is image yes
don't forget in the glue section we
give a ku sign elbow rung like this
then if for example we have
determined for the name is
far then we enter it in the
HP detail page section yes image file
then we will output the data yes
es image for example we because Es
now Let's try to do
a loop from the uploaded image
we just copy it from the top
here yes Let's just blog I blog
from the top and race Put it at the
bottom control es the comment I
remove yes he will run from the
previous command if the image is valid yes
according to the image is valid and then
here the typical image move he will be
moved for example we move it to
another place yes not upload image
for example I will move it to multiple
image yes I contest then if
for example the process is complete we
will move it to another location
yes by using set flashdata
fashion-fashion use
You go bracket yes season you hot set
flash data yes Res data we enter
success for example we give the writing
successful upload upload data yes then
we Christian Christian then we will
redirect him to the location redirect redirect
yes then we enter the arrow
deck yes then we Palace now
Let's look again in the fastest browser section
jus file we will specify two
files or one file first try I
enter two files yes then I
select in the Open section I click on the
send data section So there is a writing that says successfully
upload data now Let's see
if he has successfully entered it
into the multiple directory
so that Explorer clothing occurs then down
we look in the public section yes we have
an image here has directly created yes
for the director multiple images we
try to see yes he has entered for the
file yes this is entered
using g-tren.com image yes which is
determined by the psychotic liter he
has entered two images
Now what if for example I
will enter two files one
image but the other is not a file yes we
see yes I select the Suspect section again
Determine for the two files is text
data and also the next is
file.png then I select in the
Open section Click on the send data section it
displays an error message yes the file is
allowed only images because earlier
we entered one for the image
then the next We have
also entered for the file the form
is txt so it is not accepted by the
Coating meter that's how we
can
do the upload process yes from images
using CodeIgniter
Thank you during alaikum warahmatullahi
wabarakatuh
More transcripts
Explore other videos transcribed with YouTLDR.

Mi niñez fue un fusil AK-47
Comisión de la Verdad · Spanish

7. Un Remanente Fiel - Pr. Esteban Bohr || Verdades Para Este Tiempo
SUMtv Latino · Spanish

PENGERTIAN RELASI, FUNGSI, DOMAIN,KODOMAIN DAN RANGE
Utak Atik Otak · English

ساعة الأثرياء | الدحيح
New Media Academy Life · Arabic

You Won't Believe How Easy AlpineQuest Software Makes Geological Field Work | Offline Mapping
MOoDY 4 knOwledge · English

Mundos Olvidados
Cinematix · English

🎨 Apa Itu Sebenarnya Pelajaran Seni? #BelajardiRumah
Kok Bisa? · English

Bab-I: Teks Laporan Hasil Observasi kelas 10 SMA/SMK ~ Bahasa Indonesia
Belajar Prestasi · Indonesian

KONSEP BUDAYA| PENGERTIAN BUDAYA DAN SENI
BU APRIL · Indonesian

العقيدة الطحاوية (٤٠) | شرح أ.د. صالح سندي
أ.د. صالح سندي · English

Living the Change: Inspiring Stories for a Sustainable Future (Free Full Documentary)
Happen Films · Indonesian

SENI BUDAYA (SENI TARI) "ELEMEN DASAR TARI"
Budianing DNA · English
Get the TLDR of any YouTube video
Process a new video with YouTLDR Pro — transcripts, summaries, translations, and repurposing in 125+ languages.