Welcome Guest, Not a member yet? Register   Sign In
Help Needed : Upload File Exists Validation
#2

[eluser]David Cassidy[/eluser]
The Upload library automatically checks whether or not the file exists. If so, it appends a sequential number to the end of the filename. You can change this behaviour if you like by extending the Upload class, or editing lines 358-377 in /system/libraries/Upload.php.

If you are just wanting a quick way to format the filename the way CodeIgniter does, the clean_file_name() method is a public function which means you can do:

Code:
if(!file_exists($config['upload_path'].$this->upload->clean_file_name($filename)))
{
      $this->upload->do_upload();
}
else
{
      echo "File exists..."
}

...to get the desired results.


Messages In This Thread
Help Needed : Upload File Exists Validation - by El Forum - 09-22-2008, 11:49 PM
Help Needed : Upload File Exists Validation - by El Forum - 09-23-2008, 12:09 AM
Help Needed : Upload File Exists Validation - by El Forum - 09-24-2008, 12:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB