SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

get server filename in OnClientUploadFileEnded function Options
jgreen
#1 Posted : Thursday, October 27, 2011 6:17:09 PM
Rank: Newbie

Groups: Registered

Joined: 3/23/2007
Posts: 9

Hello:

I am using the slick mvc3 sample project as my base.  I've added a custom filename generator and code to resize the image.  I'd like to show the user a thumbnail of the image after the upload but can't find the filename that the custom filename generator used.  Is it possible to get this information in the OnClientUploadFileEnded javascript function?

Thanks,

Axosoft
#2 Posted : Monday, October 31, 2011 7:07:33 PM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

You can set data in the UploadStreamProvider via the file.Data dictionary, like this:


file.Data["thumbUrl"] = "somevalue";

Then, in the OnClientUploadFileEnded function, you can retrieve the value like this:

        function onFileUploadEnded(file)
        {
            var status = file.get_Status();

            if (status.errorType == "None")
            {
                var thumb = file.getElementById("thumb");

                thumb.src = status.thumbUrl;
                thumb.style.display = "block";
            }
            else
            {
                // TODO: probably an invalid image -- handle the error
                alert("Invalid image!");

                kw("<%=slickUpload.ClientID %>").remove_File(file);
            }
        }

jgreen
#3 Posted : Tuesday, November 01, 2011 11:57:50 AM
Rank: Newbie

Groups: Registered

Joined: 3/23/2007
Posts: 9
Thanks, Chris. That was exactly what I needed.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.