Jump to content

Recommended Posts

Hi,

 

I am using a script to upload media files. Here it is:

$filename_audio = 'uploadintaudio';
   $tmpName_audio = $_FILES[$filename_audio]['tmp_name'];
   if(empty($_POST['intclip_which']))  {$_POST['intclip_which'] = 0;}	   
   if($_POST['intclip_which'] == 1){	//change image only				
   	echo 'MEDIA --> <br/>
   	name '.strtolower($_FILES[$filename_audio]['name']).'<br/>
   	isset? '.isset($_FILES[$filename_audio]).'<br/>	   	
   	which '.$_POST['intclip_which'].'<br/>
   	error '.$_FILES[$filename_audio]['error'].'<br/>
   	type '.ereg($media_types,strtolower($_FILES[$filename_audio]['type'])).'----
   	'.$_FILES[$filename_audio]['type'];	   
	   if (isset($_FILES[$filename_audio]) && ($_FILES[$filename_audio]['error'] != 4) && ereg($media_types,strtolower($_FILES[$filename_audio]['type']))) {     
	   		$intaudio = array_change_key_case($_FILES[$filename_audio],CASE_LOWER);			   		
	   	} else {
        $intaudio = FALSE;
        $ErrorMsg .= 'Either the file format is incorrect or you have not choosen a media file.<br />';			   				   		
     	} 
	 } else {$intaudio = TRUE;} 
	 $intaudio_name = strtolower($intaudio['name']); 	    
   $intaudio_type = strtolower($intaudio['type']); 	    
   $intaudio_size = strtolower($intaudio['size']); 	

 

Note:

$media_types = "(rmi|wav|wma|wmv|wm|wmvhd|wax|mpg|mid|midi|mpeg|m1v|mp2|mp3|mpa|mpe)\$";/*avi|asf|asx|*/

 

You can see i print (echo) the file name, error, type, etc. This is my result:

MEDIA -->

name butterfly.wmv

isset? 1

which 1

error 1

type ----

 

As you can see the file type is missing. And the error =1 which means the max-uploadsize is not enough. The file size im trying to upload is 2.5M and my max post and max upload size is set to 50M.

 

I am not sure where the problem is.

 

Any help is welcomed.

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/176728-uploading-media-files-trouble/
Share on other sites

max post and max upload size is set to 50M.
Yes, but what are the actual settings that a phpinfo() statement shows and where exactly did you change the settings at?

 

If there is a syntax error in the setting or the method that you used to set it is not the one that php is using, the setting is not actually change to what you think it is.

Are those the local values or the master values?

 

Also,

where exactly did you change the settings at?

 

You would not be getting that value for the ['error'] element unless the size of the file is larger than the upload_max_filesize setting that php is using. Either the size of the file is not what you think it is or the actual setting that php is using is not what you think it is.

Was the file with the phpinfo() in the same folder where your upload script is at?

 

You may want to check with your web host because if they have not configured the server to allow you to change the php settings, they might not actually get changed to the values you set, despite what the phpinfo() shows.

there is one php.ini file in the main web root directory and the file is in another folder.

in this website cpanel, it has php config area. there the php file is selected as single file. meaning one file for the whole site. so i wont need to duplicate the php.ini file.

this is the options i have in the php config in cpanel:

 

PHP5

All files with the extension .php will be handled by the PHP5 engine.

Current, most reliable and best performing version of PHP

 

PHP5 (Single php.ini)

Same as PHP5, but all subdirectories will use ~/public_html/php.ini

 

PHP5 (FastCGI)

All files with the extension .php will be handled by PHP5 FastCGI processes.

FastCGI for PHP makes all your PHP applications run through mod_fastcgi instead of mod_suphp. This eliminates the overhead of loading the PHP interpretor on every hit. Since it is always in memory ready for the next hit, the responses will be generated faster.

 

 

PHP5 (Single php.ini) is selected.

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.