![]() |
|
|||
|
I am trying to create a 4 page form, where the user can input various pieces of info and upload some images and then the last form is a confirmation form where if the user confirms then its all saved to my database. Similar deal to a standard ebay form for example. Does anyone have any suggestions how best to go about this? I plan to allow users to upload images on form2, how do i take care of this in a way where they only get added if the user confirms on page4? Is there any way I can simply add the images to the Zend Session like I can with normal zend form text elements or is this not possible. Another way I was considering was to simply upload them to a temp folder named after the users id, renaming the files to timestamps and storing these filenames in the session then if user confirms, then my model can grab the filenames of the uploaded files and move them into their correct folder, resize them and store their address in the database. Is this the best way to go about it or does anyone have any better suggestions. One problem with the above approach is that my server will after a while contain a number of images in the temporary folder that have been uploaded but where the user hasn't completed the form, I would thus need to delete these later using some kind of script. This is not a big problem I guess, still if anyone has any suggestions as to any better way to tackle this problem I would love to know! Thanks
|
|
|||
|
that's right, a temp folder or a temp db table that would store that data will do the job.
In the case of a temp folder I would create a subdirectory for the session (that is, directory name = session id) and create script that would be fired up at the end of the session. The end of the session would mean: 1. The user has submitted the form, action: move the valid data to the designated location and delete the temp subdirectory; 2. the user left without completing the form properly or in a timely manner (= session timeout), delete the temp subdirectory. As to a db table, it depends on you app design whether or not this would be more sensible. You may also want to take a look at these answers: PHP - Store Images in SESSION data ??? - Stack Overflow I would also advise against storing images in the session variable. |
|
|||
|
excellent, thanks a lot for quick response, really appreciate it.. I think I will just store them in a sub directory as I don't store any other images in my db.
I've been reading around quite a bit about sessions, haven't really done any real web development before, I am a student and more familiar with standard C, C++.. When assigning a session using $formSession = new Zend_Session_Namespace('registerForm'); this automatically creates a session and sets a unique session id, right? And why use the namespace, is it so you can have different setting for different types of sessions? and finally do you access the underlying php sessions by $formSession->__get('id'); ?? Last edited by nfrandsen; 07-02-2009 at 12:02 AM. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Designed by: Miner Skinz |
Powered by vBulletin® Version 3.8.4 Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.1.0 |
![]() |