Jump to content

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.