Jump to content

Upload Avatar On Sign Up


unemployment

Recommended Posts

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.

Link to comment
Share on other sites

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])

  1. 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 information
  2. file
    store the temporary file location for display and to pull back for completed registration
  3. timestamp
    that 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 registration
    Server moves Upload to stored avatar location and removes the record in the DB based on Session ID.
  • User forfeits registration
    Server 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.)

Link to comment
Share on other sites

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 :tease-03: )

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.