There is a user registration module which requires users’ logo to upload before register. I’m facing problem of where to store this uploaded image, because at the time user is uploading the logo, the actual user item is not created.
有一个用户注册模块,要求用户的徽标在注册前上传。我遇到了存储此上传图像的问题,因为在用户上传徽标时,不会创建实际的用户项。
As solution for that, I can think of saving the uploaded image (until create the actual user item) in a session variable. Will that be a good idea in terms of performance and longtime use of the system?
作为解决方案,我可以考虑在会话变量中保存上传的图像(直到创建实际的用户项)。在性能和长期使用系统方面,这是一个好主意吗?
2 个解决方案
#1
2
Sounds like a bad idea. Using session for state will always adversely affect your ability to scale your application and putting large binary blobs into the session will put significant memory pressure on your application. A much better solution would be to store the images into a temp area in the file system and implement a regular sweep function that would clear out any uploaded images that were uploaded by users that didn't convert to registered users (for example, any images more than a day old). Obviously, when a user does complete the registration you would move the image out of temporary storage.
听起来不错。使用状态会话将始终对您扩展应用程序的能力产生负面影响,并将大型二进制blob放入会话中会给应用程序带来巨大的内存压力。一个更好的解决方案是将图像存储到文件系统中的临时区域,并实现常规扫描功能,清除由未转换为注册用户的用户上传的任何上传图像(例如,任何图像)超过一天)。显然,当用户完成注册时,您会将图像移出临时存储。
#2
-1
I would suggest to use a temperary folder where you store your files giving them some unique names (using Guid, for example).
我建议使用一个temprary文件夹来存储你的文件,给它们一些独特的名字(比如使用Guid)。
#1
2
Sounds like a bad idea. Using session for state will always adversely affect your ability to scale your application and putting large binary blobs into the session will put significant memory pressure on your application. A much better solution would be to store the images into a temp area in the file system and implement a regular sweep function that would clear out any uploaded images that were uploaded by users that didn't convert to registered users (for example, any images more than a day old). Obviously, when a user does complete the registration you would move the image out of temporary storage.
听起来不错。使用状态会话将始终对您扩展应用程序的能力产生负面影响,并将大型二进制blob放入会话中会给应用程序带来巨大的内存压力。一个更好的解决方案是将图像存储到文件系统中的临时区域,并实现常规扫描功能,清除由未转换为注册用户的用户上传的任何上传图像(例如,任何图像)超过一天)。显然,当用户完成注册时,您会将图像移出临时存储。
#2
-1
I would suggest to use a temperary folder where you store your files giving them some unique names (using Guid, for example).
我建议使用一个temprary文件夹来存储你的文件,给它们一些独特的名字(比如使用Guid)。