CogiMail - A simple-featured upload/rename and resize(later, not yet) class for PHP
Class Features
- A simple code for uploading file from PHP
- Upload, rename and eventualy resize (later, not yet) the file
- Error messages in english only
- Generate exception if a trouble appears
- Compatible with PHP 5.0 and later
Why you might need it
Because it is really boring to develop this ;), (*1)
License
Coming soon., (*2)
Installation & loading
At the moment, you just have to copy the class file in the folder you want., (*3)
What's included
Within the download you'll find the following directories and files. You'll see something like this:, (*4)
cogiupload/
โโโ bat/
โ โโโ checkstyle.bat
โ โโโ phpdoc.bat
โโโ class/
โ โโโ CogiUpload.class.js
โโโ doc/
โ โโโ ...
โ โโโ index.html
โโโ psr/
โ โโโ ...
โ โโโ index.html
โโโ test/
โโโ testCogiUpload.php
โโโ image1.jpg
โโโ image2.gif
โโโ image3.png
โโโ image4.jpeg
โโโ fichier1.pdf
โโโ fichier2.doc
โโโ uploads
โโโ ...
โโโ ...
A Simple Example
setPathToUpload('uploads');
//$upload->setNameForFile('mynewfile');
/**
* Process the file
*/
$url = $upload->processUpload();
?>
<h2>Upload done</h2>
<div>
<?php
echo "<p>Very good, the upload is done !</p>";
echo "<p>URL : " . $url. "</p>";
$upload->debug();
?>
</div>
<?php
} catch(Exception $e) {
echo '<p>Exception : ' . $e->getMessage() . '</p>';
$upload->debug();
}
}
?>
Please select a file to upload
That's it. You should now be ready to use CogiUpload !, (*5)
Localization
English only at this time., (*6)
Documentation
The complete documentation is in the doc folder., (*7)
Tests
There is a test page in the test folder to try the component., (*8)
Contributing
An idea or a comment, please email to Philippe, (*9)
Changelog
See changelog., (*10)
History
- At the beginning, CogiUpload was a procedural function in a PHP library.
- Then, this function became a Class.
- Now, CogiUpload is in a BitBucket repository.
- With Readme, and a PhpDocumentor folder.
- And Cherry on the Cake, there is a PSR folder to see the quality of the code ;-)