Jump to content

In Need of Advice on user image management!!!!


TGWSE_GY

Recommended Posts

Hi Guys,

 

I am wondering if anyone knows of any decent tutorials on using PHP to allow users to upload images to their accounts and managing the files for retrieval.

 

I am finding this one of the most frustrating of topics, simply for it complexity especially since I am a beginner moving into intermediate topics.

 

Thanks Guys!!!!!  8)

This is a very good basic file upload tutorial

http://www.tizag.com/phpT/fileupload.php

 

below is a little snippet that would deny certain file extensions

$tmpp = explode ( '.', $_FILES['file']['name']);
   $fileext = $tmpp[count($tmpp)-1];

$allowedexts = array("mp3", "jpg", "bmp", "wav", "gif", "png", "jpeg", "wma" );
$imgexts = array("jpg", "bmp", "gif", "png", "jpeg" );
$muext = array("mp3", "wav", "wma" );
    if (in_array($fileext, $allowedexts)){
	if (in_array($fileext, $imgexts)){
		$filetype1 = "art";
	}
	if (in_array($fileext, $muext)){
		$filetype1 = "music";
	}
}
else {
        print "File not trusted!";
	exit();
    } 

 

hope that helps!

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.