PHP Tutorials: Register & Login (Part 23): Profile Image Upload (Part 2)

preview_player
Показать описание

Official site

Twitter
Рекомендации по теме
Комментарии
Автор

Hey, you can change your settings to show file extensions. click the arrow on organize while in any folder > click the view tab > uncheck "hide extensions for known file types"

Archey
Автор

I had the same error concerning Strict Standards ... but to be sure:
but what is it on line 66???
If it has to do with the end() function, then you have to split the code. What i did was the following:
$file_extn=explode('.', $file_name); //file.png
$file_ext=end($file_extn);
print_r($file_ext);

latlov
Автор

Really nice tutorial. I was hoping to see some SQL and MySQL tutorials, as from what i am learning, are very complex with commands and privileges and it comes a point very boring to learn.

Anothergames
Автор

For file extension why not use $_FILES['profile']['type']? It already has the ext in it.

P.S. Nice tutorials. Lot of interesting things to learn!

FENDTlv
Автор

When I upload a video or audio file it doesn't say anything even if the $allowed variable specifies only jpeg + png. However, when I upload a php file it does display the "wrong file type" message. It's a  little bit weird..

ClassicCartoonsNL
Автор

there's something weird happening as I have to log in twice to log on sucessfully. first log in goes to index with no error message. second login works. any ideas?

MrChibakun
Автор

Instead of using $file_extn = strtolower(end(explode('.', $file_name)));
replace it with $file_extn = strtolower(pathinfo($file_name, PATHINFO_EXTENSION));

rofusdelacruz
Автор

what if I rename an .exe, bin etc file to png or jpeg? or huge files, over 10 mb? 

waroracle
Автор

HELP! i am getting this error:
Strict Standards: Only variables should be passed by reference in

RonDavisceo
Автор

i will say this just once, if you have benefited from alex's wisdom and you have not donated, you will go to hell. BTW thanks again alex.

gabbixans
Автор

OK fixed it thanks Rotus now i have another issue the photo doesn't show

RonDavisceo
Автор

what is the pathinfo and pathinfo_extension?

RonDavisceo
Автор

the error is in this location...
$file_extn = strtolower(end(explode('.', $file_name)));

RonDavisceo
Автор

if anyone gets the "Strict Standards: Only variables should be passed by reference end explode" error you can make it work like this

$array = explode('.', $file_name);
$file_extn = end( $array);

synthakt
welcome to shbcf.ru