[eluser]jedd[/eluser]
[quote author="Sein Kraft" date="1260081822"]
I've a simple file uploader wich set the avatar for the user but i want also add an input for set the avatar from url.
[/quote]
I'm going to ignore your upload process and code, because uploading files is covered in detail elsewhere, and I don't think (?) this is the root of the question you're asking. I think you're asking how you can allow for a URL for an avatar
or a file that the user has uploaded.
Is this right? If so, read on.
How I'd do it is .. have a flag in the user table that denotes the preference on local image or URL. Have space in the user table for the URL to reside. Have a directory somewhere that contains avatars, with the name of the file being the user.id or user.name - ie. unique to that user.
A function that says 'get url for user X's avatar' - takes a single parameter of user.id, and returns a string (url). Internally the function checks for the user table flag that denotes local .v. remote URL, if the latter returns it. If the former it creates a url based on the local web path / file system.
I'm not sure what performance issues you're expecting - the above is fairly streamlined, I think.