I'm doing something similar but images are not uploaded until a user
has been enabled, so the ID will already exist, of course. You may not
have that luxury. I do have a resumé upload but, instead of using the
UID, I'm naming it after the user's name. I'm already creating a
"slug" anyway from the first & last names, for other purposes. Like,
John Smith will get the slug, "john_smith" (yes, I check to make sure
a slug is unique).

In my case, I don't want to ever have several versions of a resumé. If
I did, though, I could just append microtime as you suggest.

On Mon, May 12, 2008 at 5:35 PM, Nicolás Andrade
<[EMAIL PROTECTED]> wrote:
> Creating a "Register" form I found with the classic dilemma:
>
> Uploading a picture.
>
>
> Uploaded file will be named UserId.OriginalExtension. I mean 5565.jpg is
> photo from user 5565 and is in JPEG format.
>
> Not bad.
>
>
> But what happens when Model does not validate, Insert is not done and there
> is no ID to use as filename?
>
>
> Does cake have something to help in this classic doubt?
>
> What's better?
>
>
> MICROTIME + SESSIONID . Extension may be the image's new name, and then keep
> it included in a HIDDEN field in form, may be a solution. Then File can be
> renamed to LastInsertedId.
>
>
>
> How do you solve this kind of common and normal issues?
>
>
> See you!
>
>
> n.
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to