Temporary files, how is it done?

I'm building a upload system that allows users to upload pictures that are going to be displayed on the website. Now I'm wondering if there is any good way of handling these picture files? Is there any CI way of handling temp-files or should I go with good old php. If so, when and how should I trigger a flush of the temp-directory?

I guess I'll go with this, or similar...

1. [Preview] --> in a view file.
2. Upload a pic to ../temp/
3. Display ../temp/picture.jpg in a view file.
4. [Submit] --> move preview to ../images/
5. unlink( ../temp/picture.jpg);

There is an Image and Upload library in CI if you didn't check that.
Image Manipulation Class

Upload image and resize uploaded image to preview size without saving. Use header() to send image data throughly browser. CI image resizing is easier then native php code.

I will copy-paste my code here When I found it.

I recommend using the move_uploaded_file() php function and let PHP handle everything else.

@Vi - The image class is just what I need. Seems to give me clean code. I'll use the work flow I described. Thank you.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.