![]() |
keeping user images in the assets/uploads dir - multiprocess question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: keeping user images in the assets/uploads dir - multiprocess question (/showthread.php?tid=79668) |
keeping user images in the assets/uploads dir - multiprocess question - richb201 - 07-16-2021 My system allows users to upload images. After each upload (to /assets/uploads) I also copy this file to my S3 bucket for this user. At the end of their system use and logoff, I delete all of the images in /assets/uploads since I have already copied their files to their s3 bucket. My system is multiuser. Does each user have their own copy of the CI environment on disk? I am asking if two users are sharing the same directory space in /asset/uploads. If that is so I really should NOT delete *.png from /assets/uploads? I do have the names of all of each users files in my table and could delete them one by one. I guess I am confused since each php program (I think) is a separate process, unlike the way we used to program in multi threading in C where all the code was shared with the use of a state machine. In CI3 does each process have its own copy of the code on the hard drive? RE: keeping user images in the assets/uploads dir - multiprocess question - craig - 07-16-2021 Quote:Does each user have their own copy of the CI environment on disk? No. Quote: I am asking if two users are sharing the same directory space in /asset/uploads Yes, all users are - unless you code it otherwise. CI and the file storage system has no concept of different or separate users of your application. As the developer, it is your responsibility to segregate the files in whatever way makes sense to you. All CI is doing is taking an uploaded file and placing it in a folder that you tell it to. My suggestions would be to do one of the following: 1) Delete the file as soon as it's successfully uploaded to S3. 2) Track files in the database, with a field to mark whether it has successfully uploaded to S3 (For example: 0 by default, 1 on success). Then you can SELECT the files where S3=1, and delete them - either in a cron job function, or periodically from pages that users visit in your site. 3) Create a folder for each user's files. RE: keeping user images in the assets/uploads dir - multiprocess question - richb201 - 07-16-2021 Thanks. I need to leave them on the local disk because otherwise koolreport can't access them ![]() If the user logs off I can easily clean up their files. But if they x out of the tab, I have a deeper issue. Perhaps once a week I can take the system down and run a cron job to clear it out but it seems like a huge pita. RE: keeping user images in the assets/uploads dir - multiprocess question - InsiteFX - 07-18-2021 Assign each user their own image folder and only allow them to view it. RE: keeping user images in the assets/uploads dir - multiprocess question - richb201 - 07-18-2021 Hi Insite. I would, except this has been designed to run on multiple servers. Why? The calculations take a significant amount of time to build the temporary tables and I am concerned about having multiple users running at the same time. Which leads me to another question, perfect for you, since I think you had recommended using Create Temporary in mysql. Is the temporary table going to be deleted when the current user logs off? From mysql's POV, there is only one user, I think. How about if two users are logged in at the same time? Do they each get their own temporary table? I could make separate temp tables for each user. RE: keeping user images in the assets/uploads dir - multiprocess question - InsiteFX - 07-18-2021 It ends automatically when the session or the database is closed, you can also use drop table when your done with it. RE: keeping user images in the assets/uploads dir - multiprocess question - richb201 - 07-18-2021 Each user has a new session (I sure hope). So in that case if two users are on at the same time, and each has a temporary file of the same name? Should I assume that temp files are in memory, and not on the drive? RE: keeping user images in the assets/uploads dir - multiprocess question - InsiteFX - 07-19-2021 You should assign a random number for wach temp table for each user. Like say adding the date and time to the temp table, but I would create a random number generator for it. |