Upload Assets

27 May 2017

  • Release 9.164
    • Added optional mono parameter when uploading scripts.
    • The command returns script compilation errors.
    • The command updates inventory assets such as notecards and scripts if they already exist in the inventory.
    • The command now uses the Corrade permission system notation.

13 July 2016

  • Release 9.105 - the command now returns both the inventory item UUID and the asset UUID of the uploaded item (if any).

10 July 2016

  • Relese 9.104 - added extended formats for the Windows platform.

4 May 2015

  • Release 7.82 - Corrade now supports uploading multiple image formats for the Texture asset type.

14 December 2014

  • Release 7.28 - added.
upload (Commands)
TypeCorrade progressive command
Commandupload
DescriptionThe upload command can be used upload assets onto the grid.
Permissionsinventory, economy
Parametersgroup, password, name, type, data
Last ChangesRelease 9.164 - Added optional mono parameter when uploading scripts; The command returns script compilation errors; The command updates inventory assets such as notecards and scripts if they already exist in the inventory; The command now uses the Corrade permission system notation.

The upload command can be used upload assets onto the grid.

Command Required Parameters Required Corrade Permissions Example
upload group, password, name, type, data inventory, economy
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // Create a script called "Good day!"
            // with the content passed to "data"
            // and set permissions to MODIFY COPY.
            "command", "upload",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "name", "Good day!",
            "type", "LSLText",
            "data", wasURLEscape(llStringToBase64("
                default {
                    state_entry() {
                        llOwnerSay(\"Good day!\");
                    }
                }
            ")),
            // "Copy" and "Modify" permissions.
            "permissions", "c--mvt------------c--mv-c--mvt",
            "callback", wasURLEscape(URL)
        ]
    )
);
Optional Parameter Description
description The description of the asset.
permissions The permissions in Corrade permission system notation for the next owner (this option is ignored for Landmarks which always have full permission).
item If an item by name or inventory path (ex: /My Inventory/Notecards/MyNote) is specified, then that item will be updated and no new item created.
mono When uploading a script, if mono is set to True (by default set to True) then Corrade will use the mono compiler instead of LSO.

The possible and currently supported uploadable assets are the following:

Parameter Possible Value Parameter Description Example
type Texture Uploads a texture that is encoded in either JPEG2000 or one of the other supported formats.
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // Upload a texture and call it Skull
            "command", "upload",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            // The name as it will appear in the
            // inventory textures folder.
            "name", "Skull",
            "type", "Texture",
            // The Base64-encoded image binary data.
            // (This is a small skull texture in TGA
            // format that has been encoded to Base64)
            "data", wasURLEscape("
                iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQAAAACCEkxzAAAAAnRSTlMAAQGU/a4A
                AADySURBVHgBjdK3lQMhGATgQd6jUBltXCJTikq48LJlnxpDZ9tAHWwow4Mb/t3z
                dqIPb5Ga/AGgEARACyqgLXAABOgHrInIrtYQQbGbJo7seewTLKWY4Q3nbGesiZJw
                BeEyEuOJUlA0qN6j/QHH9XsYYkG0iDjI0N8hLBpEwUQfZwMC87ZvgTNbKK9qwEGw
                cc7ajNLv/TZvdeecYL+zbiuwykPg2hU8Ufr+UeWtKt8P7Srv8Di/08c1eBFVOwkO
                VfsgsNdte8M+wNUTIDCxXh06AHnRiQ4TRRxXOpg+kSKR/g3lGwBrQXqFRVHDqVQj
                mN//xjODplxESg0eZQAAAABJRU5ErkJggg==
            "),
            "callback", wasURLEscape(URL)
        ]
    )
);
Sound Uploads a sound in OGG Vorbis format.
Animation Uploads an animation in .animatn format.
Clothing wear Uploads wearables for a certain clothing slot (wear) set to one of the values of the WearableType enumeration.
Bodypart wear Uploads body parts for a certain slot (wear) set to one of the values of the WearableType enumeration.
Landmark Uploads landmarks.
Gesture Uploads gestures.
Notecard Uploads notecards.
LSLText Uploads scripts.

and the data passed to the data parameter is compatible with the data retrieved by the download command.

Supported Texture Image Formats

Grid clients such as Corrade download and upload textures to the grid in the JPEG2000 image format. The upload of textures in different formats other than JPEG2000 is provided as a convenience but Linden grids can only accept JPEG2000 images. In other words, regardless of the image format that you want to upload, Corrade will have to convert the image to the JPEG2000 format (with lossless compression) and only then upload it. You may want to rethink your application in case you really depend on some format provided here and convert your images to JPEG2000 yourself before uploading. For instance, under Windows, uploading a 24-bit PNG is meaningless from Corrade's perspective because the grid does not accept such a format (only JPEG2000) such that the 24-bit PNG will be first converted to JPEG2000 and then uploaded.

A counter-example when using any other format other than JPEG2000 is useful is when would you need to upload or download an image from PHP (or other environemnts) that do not have built-in support for the JPEG2000 image format. In such cases, in order to not over-complicate your script, you can use the formats listed here depending on your platform. However, as mentioned previously, be weary because grid clients can only upload textures in the JPEG2000 format such that you could probably convert your image to JPEG2000 better than having Corrade do it for you.

Platform Formats
Windows ThreeFr, A, Aai, Ai, Art, Arw, Avi, Avs, B, Bgr, Bgra, Bgro, Bmp, Bmp2, Bmp3, Brf, C, Cal, Cals, Canvas, Caption, Cin, Cip, Clip, Clipboard, Cmyk, Cmyka, Cr2, Crw, Cur, Cut, Dcm, Dcr, Dcx, Dds, Dfont, Dib, Dng, Dpx, Dxt1, Dxt5, Emf, Epdf, Epi, Eps, Eps2, Eps3, Epsf, Epsi, Ept, Ept2, Ept3, Erf, Exr, Fax, File, Fits, Flif, Fractal, Ftp, Fts, G, G3, G4, Gif, Gif87, Gradient, Gray, Group4, Hald, Hdr, Histogram, Hrz, Htm, Html, Http, Https, Icb, Ico, Icon, Iiq, Info, Inline, Ipl, Isobrl, Isobrl6, J2c, J2k, Jng, Jnx, Jp2, Jpc, Jpe, Jpeg, Jpg, Jpm, Jps, Jpt, Json, K, K25, Kdc, Label, M, M2v, M4v, Mac, Map, Mask, Mat, Matte, Mef, Miff, Mkv, Mng, Mono, Mov, Mp4, Mpc, Mpeg, Mpg, Mrw, Msl, Msvg, Mtv, Mvg, Nef, Nrw, Null, O, Orf, Otb, Otf, Pal, Palm, Pam, Pango, Pattern, Pbm, Pcd, Pcds, Pcl, Pct, Pcx, Pdb, Pdf, Pdfa, Pef, Pes, Pfa, Pfb, Pfm, Pgm, Picon, Pict, Pix, Pjpeg, Plasma, Png, Png00, Png24, Png32, Png48, Png64, Png8, Pnm, Ppm, Ps, Ps2, Ps3, Psb, Psd, Ptif, Pwp, R, RadialGradient, Raf, Ras, Raw, Rgb, Rgba, Rgbo, Rgf, Rla, Rle, Rmf, Rw2, Scr, Screenshot, Sct, Sfw, Sgi, Shtml, Six, Sixel, SparseColor, Sr2, Srf, Stegano, Sun, Svg, Svgz, Text, Tga, Thumbnail, Tif, Tiff, Tiff64, Tile, Tim, Ttc, Ttf, Txt, Ubrl, Ubrl6, Uil, Uyvy, Vda, Vicar, Vid, Viff, Vips, Vst, WebP, Wbmp, Wmf, Wmv, Wpg, X3f, Xbm, Xc, Xcf, Xpm, Xps, Xv, Y, Ycbcr, Ycbcra, Yuv
Mono Bmp, Emf, Exif, Gif, Icon, Jpeg, Png, Tiff, Wmf

Encoding Assets for Upload

For example, to upload a texture, you would have to have an image encoded in one of the supported image formats. For this example, let's assume you have a JPEG2000 image. You would Base64-encode the JPEG2000 code-stream image. After that, you send the upload command to Corrade with the value of the data key set to an URL-encoded string of the Base64-encoded JPEG2000 code-stream image.

In other words:

  • you have an initial JPEG2000 code-stream image file.
  • you encode the image file as a Base64 string.
  • you encode the Base64 string in an URL-encoded string.

The reason for multiple levels of encoding is that Base64 uses the equal sign (=) as a padding element which interferes with key-value data syntax.

Since Base64 encoding may produce large strings, a reliable way to upload assets is to use Corrade's internal HTTP server instead of writing large strings in LSL.

Assets such as clothing, landmarks, gestures, notecards and scripts can be uploaded (created) as the reverse operation of the download command. Each of these assets are Linden-based formats which, some of them, can be reconstructed intuitively in plain-text. For example, scripts as LSLText requires the encoded data to be just a plain-text LSL script. Landmarks, clothing, gestures and notecards also have their own specific Linden-based format. If you are curious to see what that format may be, use the download command on some clothing and then Base64 decode the data returned by Corrade.

Returned Data

Under the assumption that the upload succeeded, Corrade will return a CSV list of item UUID by asset UUID (if any) that can then be used for other commands in order to refer to the asset that has been uploaded. Additionally, if the asset was a script and the script failed to compile, then the command will return the script compilation errors.


secondlife/scripted_agents/corrade/api/progressive/commands/upload.txt ยท Last modified: 2017/05/27 20:27 by Wizardry and Steamworks

Access website using Tor


For the copyright, license, warranty and privacy terms for the usage of this website please see the license and privacy pages.