From: someone
What are the optimal size of a texture that can be uploaded?
The optimal size in my opinion is 256x256.. but it all depends on the purpose of the texture. If you are going to be using the texture on large 10x10 walls then perhaps 512x512 would be more beneficial for you however if you are going to be using it for smaller objects than a smaller resolution is all you need.
Remember that when a player views a building that has a large textures on each prim, that the video hardware still has to load and unload that amount of texture memory each time the prims come into view and out of view again. So if you had a bunch of small prims, each 1m by 1m, and all had 512x512 sized textures, it would be slower than if they all had 128x128 textures on them.
You can also have a texture at 256x128 (where 256 is the width) for a sign perhaps.. the basic rule of thumb is that it should be as small as you can make it without compromising quality.
Also.. if the texture is to be completely opaque, that is it will not be clear at all, remove all alpha layers/channels before uploading it. This will not only speed up the upload of the texture but it will also speed up the processing of the texture in the game because any texture with an alpha layer causes extra load on a video card. Fully opaque textures with alpha layers have also been known to cause graphical glitches in SL, so it's best to avoid it in general anyway.
From: someone
And what file type(s) are the best to use??
Here is the information from the wiki on Textures:
Texture
A texture is an image that can be applied ("texture-mapped"

onto an object's surface, particle, or avatar. Images saved in JPEG, TGA, and BMP format may be uploaded to Second Life as textures. These formats are converted to a variant of the JPEG2000 format (using the Kakadu library) and sent to the Second Life asset server when uploaded. There is a $L10 fee for each upload.
Textures are indexed in your inventory and can be used in a variety of ways in the viewer and editor modes of the client, as well as via LSL. Dragging them onto a specific object face will place a texture on that face. Shift-dragging a texture from the inventory to a prim will apply it to all faces.
Because all uploaded images are decoded and converted to JPEG2000, it is inadvisable to convert textures into the JPEG format prior to uploading. JPEG is a lossy format and using it will potentially introduce unnecessary additional loss and distortion to the final uploaded texture. Uploading images in the TGA format is recommended.