Changing the upload class... |
[eluser]awpti[/eluser]
Howdy folks, Been quite a few years since I've touched PHP, let alone CI. I'm at a loss here. When a file <image> is uploaded, I want to create a hash based on the time, filename and filesize. Once this is done, I want the upload path set to (example): HASH = aefbe89530ecdae7496cefa4915307ef, Path is... /a/ef/aef/aefbe89530ecdae7496cefa4915307ef.jpg But I just can't wrap my head around how to change the upload_path after I've initialized the Upload class. Will I have to actually modify the Upload class itself to do what I want? Or can I *reinit* the upload class with the new path somehow?
[eluser]Aken[/eluser]
Why don't you set a temporary upload path, then once the upload succeeds, create your hash, then use PHP's rename() (and probably mkdir()) to move the file to its permanent location.
|
Welcome Guest, Not a member yet? Register Sign In |