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

Custom filename issue Options
hotlazydaze
#1 Posted : Saturday, December 03, 2011 7:32:16 PM
Rank: Member

Groups: Registered

Joined: 10/3/2011
Posts: 13
Location: Spain

Hi,

I've been trying to change the save location for the uploaded file using the customFileName example but I get the error: 'The given key was not present in the dictionary' on the line string fileRoot = file.UploadRequest.Data["fileRoot"];

The key isn't getting set but I've checked the JavaScript function that sets the key and it is called okay. The client code is:

        function onSessionStarted(data)

        {            

    kw("<%=SlickUpload1.ClientID %>").set_Data("fileRoot", "Uploads");

        }

 

I was playing around with this for hours and couldn't see any reason why it wasn't working so I ran the examples in VS2010 and I get the exact same error with the customFileName example. The version I am using is: 6.1.2.14943 and it is licensed.

Any ideas what might be happening?

Thanks

Simon

Axosoft
#2 Posted : Monday, December 05, 2011 11:55:46 AM
Rank: Administration


Groups: Administrators

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

Try upgrading to the latest (6.1.4) version -- http://krystalware.com/slickupload/download. 6.1.3 fixed a regression issue with upload data passing in certain browsers that was introduced in 6.1.2.

Let me know if this solves the issue for you.

hotlazydaze
#3 Posted : Thursday, December 29, 2011 5:32:22 AM
Rank: Member

Groups: Registered

Joined: 10/3/2011
Posts: 13
Location: Spain
Hi Chris,

The upgrade did the trick and I can get the values from the keys on the server now in the slickUpload_UploadComplete event but I am still unsure as to how I can change the file location using the value. Your customFileName example doesn't show any server-side code using the passed keys so I assumed that the fileRoot key was automatically used to override the file save location, but I was wrong.

Can you please explain where I can catch the key value on the server and how to use it to override the default save location?

Thanks

Simon
Axosoft
#4 Posted : Thursday, December 29, 2011 8:57:34 AM
Rank: Administration


Groups: Administrators

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

To set the location of an uploaded file, you'll use a custom upload stream provider class. Uploads occur before the page is handled by ASP.NET, so you have to put the filename logic in a separate class that inherits from UploadStreamProviderBase or one of the builtin upload stream providers like FileUploadStreamProvider.

Take a look at Storage\CustomFileNameUploadStreamProvider.cs or Storage\CustomFileNameUploadStreamProvider.vb in the sample project. That overrides the GetServerFileName method to return a filename based on the passed in data. The customFileName upload profile is configured to use that upload stream provider to store files.

hotlazydaze
#5 Posted : Thursday, December 29, 2011 10:34:53 AM
Rank: Member

Groups: Registered

Joined: 10/3/2011
Posts: 13
Location: Spain
Thanks for the quick response Chris. I will look into it.
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.