hamedghaderi's avatar

Remember the owner of an uploaded file without force him to sign in?

Hi. I'm building a website which has an upload file component.

Now for some UX reasons, I let users upload their documents before making an account in the first step and save their file metadata into a table. I have to do some calculations on the documents and show them a price and then in the second step let them make an account.

Know the question is how to remember which file belongs to which user in the third step? Can I use local storage or it's risky? How should I handle the steps and make a relationship between a user and an uploaded document?

What's the best practice?

0 likes
4 replies
ronon's avatar
ronon
Best Answer
Level 9

I would go with a cookie. User visits your site -> set cookie with an unique id. User uploads documents -> use that id and prefix the filenames. User registers -> Parse the files and assign the user to it.

Note: Any client side method may break if the user uses private sessions or things like NoScript

1 like
Tray2's avatar

Why not just ask them for their email when they upload the image?

hamedghaderi's avatar

@RONON - Tanx, I like this approach. I'll try it out but maybe it's better to save the unique cookie inside the database instead of adding to filenames.

Please or to participate in this conversation.