Page 1 of 1

Uploading files with "%" not working

Posted: Tue Oct 25, 2011 11:52 pm
by loadafile
A little road block...

If you go to my site www.loadafile.com and upload any file with a "%" in the title you get this error

Warning: sprintf() [function.sprintf]: Too few arguments in /home/content/54/6252454/html/library/database/mysql.php on line 125
A database error has been encountered

I am not sure if the mysql.php is set correctly here is line 125 is anyone know what could be the problem?

Code: Select all

public function query( $query, $shutdown=false )
	{
		if( $shutdown )
		{
			$this->_shutdownQueries[]	= $query;
			return null;
		}

		//-----------------------------------------
		// Set our prefix
		//-----------------------------------------
		
		if( strpos( $query, '%s' ) !== false )
		{
			$query	= sprintf( str_replace( '%s', '%1$s', $query ), $this->_settings['prefix'] );
		}
		
		//-----------------------------------------

Re: Uploading files with "%" not working

Posted: Wed Oct 26, 2011 1:43 am
by social_experiment
The script should check the filenames before uploading them and if possible rename the file before uploading

Re: Uploading files with "%" not working

Posted: Wed Oct 26, 2011 2:39 am
by loadafile
how is that done? can somone help......


why is it giving me that error

Re: Uploading files with "%" not working

Posted: Wed Oct 26, 2011 3:08 am
by social_experiment
For each argument you supply you need a conversion specification (%s). The error is probably triggered because the % in the filename is seen as another conversion specification for which you don't supply an argument.

How do you use the files within the context of this script, user profile photos, etc?