Jump to content

Upload Security


cortez

Recommended Posts

Hello all.

Hoping someone could help me modify this bit of code.

<?php
//create the directory if doesn't exists (should have write permissons)
if(!is_dir("./files")) mkdir("./files", 0755); 
//move the uploaded file
move_uploaded_file($_FILES['Filedata']['tmp_name'], "./files/".$_FILES['Filedata']['name']);
chmod("./files/".$_FILES['Filedata']['name'], 0777);
?>

I am much better with flash then php but I'm learning.

This script is from a tutorial. It is protected through flash no problem but I want to make sure it is okay through the php as well.

It's for a CMS I built and I only need it to allow .jpg images nothing else.

 

Can someone lend a hand in pointing me in the right direction?

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/207175-upload-security/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.