This class manages file uploads for you. In short, it manages the uploaded file, and allows you to do whatever you want with the file, especially if it is an image, as many times as you want. It ...
This class manages file uploads for you. In short, it manages the uploaded file, and allows you to do whatever you want with the file, especially if it is an image, as many times as you want. It is the ideal class to quickly integrate file upload in your site. If the file is an image, you can convert and resize it in many ways. That's all you need for a gallery script for instance. How does it work? You instanciate the class with the $_FILES['my_field'] array where my_field is the field name from your upload form. The class will check if the original file has been uploaded to its temporary location. You can then set a number of processing variables to act on the file. For instance, you can rename the file, and if it is an image, convert and resize it in many ways. You can also set what will the class do if the file already exists. Then you call the function process to actually perform the actions according to the processing parameters you set above. It will create new instances of the original file, so the original file remains the same between each process. The file will be manipulated, and copied to the given location. The processing variables will be reseted once it is done. You can repeat setting up a new set of processing variables, and calling process again as many times as you want. When you have finished, you can call clean to delete the original uploaded file. If you don't set any processing parameters and call process just after instanciating the class. The uploaded file will be simply copied to the given location without any alteration. This class requires the GD library.
Version 0.14 Platform Windows ,FreeBSD ,Mac OSX ,Sun ,Linux