I'm using the jquery file upload script and it's working really well so far. The last obstacle I have is I only want to use jpg images for my website but allow users the option of uploading gif, png, or jpg.
I'm assuming I need to alter or add some additional methods to the upload.class.php file to accomplish this.
Has anyone done this before and if so is this the correct file to modify?
You will need to write some pretty tough conversion functions if you want to implement it in pure JavaScript and you'll be limited to modern browsers that support FileAPI
and FileReference
. Also the conversion function you'll have to write would manipulate the files at the binary level and will have to respect some pretty strict file structures as specified by GIF/JPEG/PNG standards specifications.
As i recall SWFUpload
(a Flash - ActionScript - JavaScript library) has this functionality embedded, you can specify the format in which it should send the file to the server but it only applies if you wish to use the resizing function which sends a resized version of the original file to the server but it has some downsides.