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

Adding value to filename prior to upload Options
shedezy
#1 Posted : Tuesday, May 04, 2010 9:57:06 AM
Rank: Newbie

Groups: Registered

Joined: 4/30/2010
Posts: 6

Sorry if this has already been covered...

I would like to just add a pre-determined value to a file name just before the extension prior to upload. i.e. user is uploading a file called myFile.jpg, the file would actually upload as myFile012345.jpg. Is there documentation on how to do this somewhere? Is it even possible? TIA

Axosoft
#2 Posted : Tuesday, May 04, 2010 4:33:00 PM
Rank: Administration


Groups: Administrators

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

What are you basing the value on? Typically, the best way to customize a filename is to use a FileNameGenerator class (see the FileNameGenerator sample).

shedezy
#3 Posted : Tuesday, May 04, 2010 5:12:20 PM
Rank: Newbie

Groups: Registered

Joined: 4/30/2010
Posts: 6

The value is based on a unique value generated earlier in the application.

Axosoft
#4 Posted : Tuesday, May 04, 2010 8:18:35 PM
Rank: Administration


Groups: Administrators

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

Are you using session state in your application? If so, you could drop the value in session when you generate it, and retrieve it in the FileNameGenerator (HttpContext.Current.Session).

If you're not using session state, you can pass the value on the query string (setting the UploadUrl property to "~/SlickUpload.axd?key=value" and retrieve it via HttpContext.Current.Request.QueryString["key"] in the FileNameGenerator.

shedezy
#5 Posted : Thursday, May 06, 2010 9:10:39 AM
Rank: Newbie

Groups: Registered

Joined: 4/30/2010
Posts: 6

No, I'm not. I'm generating the number on the page load of the same form the upload control is on. I'm trying to use the FileNameGenerator and am getting:

 

Could not instantiate file name generator

 

Essentially all I have done though is change the config to match the sample and changed the UploadURL location to also match the sample. Obviously I'm missing some pieces here.

Axosoft
#6 Posted : Thursday, May 06, 2010 9:31:45 AM
Rank: Administration


Groups: Administrators

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

The FileNameGenerator needs to be a class that implements IFileNameGenerator. Also, follow the class reference syntax here: http://krystalware.com/Products/SlickUpload/Documentation/concepts/assembly-reference.aspx. If you still can't get the reference working, email me your FileNameGenerator class and web.config and I'll take a look. chrish at krystalware dot com.

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.