unemployment Posted October 10, 2012 Share Posted October 10, 2012 Hey guys, I'm in the process of putting together a sign up form and I'm trying to figure out how to construct the page so that the user can first upload their avatar and then finish the form and create an account. Do you know how this is done logically? Do people upload the avatar via ajax and store it in some temperary folder after the photo has been uploaded? The problems is... if you're a user and you load the sign up page and upload a photo, after that photo gets upload via ajax and spit back out on the page, what happens? Does the photo get uploaded or are you just showing a desktop representation of that photo? Does the photo get uploaded when the full form is submitted? If the photo get's uploaded after an ajax call, how do you tie the uploaded photo to the signed up user after the form is submitted? Also, if the user uploads an avatar, but doesn't complete the form, how do you handle that situation? Do you know of any tutorials that outline this well? I'm essentially trying to implement the same functionality seen on pinterest's sign up form. Quote Link to comment https://forums.phpfreaks.com/topic/269288-upload-avatar-on-sign-up/ Share on other sites More sharing options...
DarkerAngel Posted October 10, 2012 Share Posted October 10, 2012 I have not gone too advanced with any new Uploading techniques in AJAX last AJAX uploading I did was using a hidden IFRAME. But hypothetically if you have the AJAX pass the upload you could (Since you are doing this at signup [god knows why]) Create a small SQL table to index the uploads and provide timing information Structure:sid (Primary)Because if the user registers [i]might[/i] prove to be the easiest way to pull back this informationfilestore the temporary file location for display and to pull back for completed registrationtimestampthat way you have some way of cron jobs to be able to identify and delete expired registration uploads[*]User uploads with AJAX and it get's stored in a temporary folder on the server[*]Server returns the temporary file location so it is able to display in the website (probably best to use a JSON return so you would be able to handle errors/exceptions) [*]Server also stores Session ID; Location of uploaded file; timestamp.[*]User completes registrationServer moves Upload to stored avatar location and removes the record in the DB based on Session ID. User forfeits registrationServer cleans files next cron script by checking timestamp against expiration limit (I am not a part of Pintrest so I have no idea how they handle this is just a draft of how I might consider handling this situation if I were presented with it.) Quote Link to comment https://forums.phpfreaks.com/topic/269288-upload-avatar-on-sign-up/#findComment-1384120 Share on other sites More sharing options...
matthewtbaker Posted October 10, 2012 Share Posted October 10, 2012 Consider using Gravatar. It prevents having to provide additional storage for images. Quote Link to comment https://forums.phpfreaks.com/topic/269288-upload-avatar-on-sign-up/#findComment-1384140 Share on other sites More sharing options...
White_Lily Posted October 10, 2012 Share Posted October 10, 2012 The Avatar upload process I'm guessing would usually happen when all the details are being processed and inserted into a database (or this is how I have always done it). Quote Link to comment https://forums.phpfreaks.com/topic/269288-upload-avatar-on-sign-up/#findComment-1384141 Share on other sites More sharing options...
DarkerAngel Posted October 11, 2012 Share Posted October 11, 2012 Consider using Gravatar. It prevents having to provide additional storage for images. I do believe this could be a reasonable thing to use, but it would depend on the context of the site. (Side note, currently using my Gravatar on phpfreaks ) The Avatar upload process I'm guessing would usually happen when all the details are being processed and inserted into a database (or this is how I have always done it). I think they wants a more interactive process during the signup, looking at the only other post they have it looks like he might have a little grasp on coding processes. You're method is probably the simplest, however it seems they would like to allow the user to upload the avatar and also be able to display it while that person is still involved in the signup process. Quote Link to comment https://forums.phpfreaks.com/topic/269288-upload-avatar-on-sign-up/#findComment-1384360 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.