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

Append query string variables to client-side uploadHandlerUrl Options
kev3232
#1 Posted : Friday, December 02, 2011 2:24:33 PM
Rank: Advanced Member

Groups: Registered

Joined: 10/27/2005
Posts: 35

Hi Chris. Is it possible to add query string variables to the uploadHandlerUrl with JS? We have other elements on the page whose values are necessary to determine the storage location. Is there an event that fires before an upload starts where we could modify uploadHandlerUrl in this way? I know about the Data array, but that appears to put the values into form variables. We have always used query string variables in the GetServerFileName override to help setup the storage location, as form variables are never guaranteed.

Thanks.

Axosoft
#2 Posted : Friday, December 02, 2011 3:41:48 PM
Rank: Administration


Groups: Administrators

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

Changing the uploadHandlerUrl isn't currently supported. You can set it once when the control initializes, but it's used for both uploading and progress requests so changing it midstream could get complex.

I know you mentioned the Data dictionary, and yes, it's sent in a form variable. Have you had issues with it? I'm not aware of any situation where a form variable wouldn't be passed along with a request. That is our recommended solution currently.

If there's an issue with using the Data dictionary, I can look into what it would take to make the uploadHandlerUrl configurable.

kev3232
#3 Posted : Friday, December 02, 2011 4:26:04 PM
Rank: Advanced Member

Groups: Registered

Joined: 10/27/2005
Posts: 35
From past versions of SU, it has been discouraged to assume Form variables would be available at any particular time. I know they "should" appear in the collection before the file bits in the post, but if I need the values in GetServerFileName (from a class that uses FileUploadStreamProvider) is it wise to use Request.Form and/or SlickUploadContext.CurrentUploadSession.Data to get them?

I wonder if a SlickUploadContext.CurrentUploadSession.QSData would be a lot of work. Maybe on the client, each key put in .set_QSData is appended with a special string or something that marks it as a QSData key on the server. Just a little daydreaming there. If the Data dictionary is "safe" for this purpose, I could go with that. But it might require me to make separate code for our UploadHandler.uplx version (a different thread in this forum).

Thanks.
kev3232
#4 Posted : Friday, December 02, 2011 5:37:47 PM
Rank: Advanced Member

Groups: Registered

Joined: 10/27/2005
Posts: 35

I probably should have typed it as file.UploadRequest.Data. Anyway, if the Data collection is the safe way to do it, I wonder if we could inject query string values into it from UploadHandler.uplx. I'm trying to avoid code duplication (Data collection vs. query string) but whatever -- the client upload control is way cool either way.

I suppose one easy solution is to use a utility function and check them both. Probably a good idea anyway so there aren't a bunch of Request.QueryString calls all over the place.

Thanks.

Axosoft
#5 Posted : Friday, December 02, 2011 7:48:06 PM
Rank: Administration


Groups: Administrators

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

That's what I would suggest.

In previous versions, SlickUpload was submitting the entire form, with files and other inputs piecemeal, so there was no control over the order. In SlickUpload 6, each file is submitted separately, in its own form (or using the HTML5 File API if supported), so we have control over the input ordering.

Let me know if this works for you.

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.