EduGarage Logo
Search:
Site Map
Upcoming Events:
Please e-mail us if you would like your webinar, conference, or get-together to be featured in this space.
Stay Informed:

Building Block to copy files from LMS to CMS

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 1 Follower

Top 50 Contributor
1 Posts
stephen.lord posted on 14 Jan 2010 3:15 PM

Here at AUT University we're working on a utility which copies files from the learning system into the CMS & relinks them (an enhancement of the "Copy Files to Collection" feature in Blackboard). To do the copy we are using a FileInputStream object and passing it the physical path of the original file:

CSFile cmsFile = ctx.createFile(newlocn,filename,new FileInputStream(oldlocation));

This is fine except that when a filename contains spaces, the physical file becomes a long string of numbers/letters eg:

[root@cepd embedded]# ls -l /usr/local/blackboard//content/vi/bb_bb60/courses/1/assess2_2009_02/content/_1581_1/embedded/
total 5704
-rw-r--r--  1 bbuser bbuser 1927176 Jan 15 09:08 !46726f6d2043616d657261203134204a616e20303031.jpg
-rw-r--r--  1 bbuser bbuser 1979128 Jan 15 09:08 !46726f6d2043616d657261203134204a616e20303032.jpg
-rw-r--r--  1 bbuser bbuser 1913750 Jan 15 09:08 !46726f6d2043616d657261203134204a616e20303033.jpg

Our question is, how can we tell which of these files is which? A regular attached file has a size property that we can access from its ContentFile object, and we can check this against the size of the physical file in Linux. If the file is embedded in the wysiwyg I'm not sure how we can access it's size property, so we're back at square one again: which of these files is which...

Steve Lord

 

Answered (Verified) Verified Answer

Top 10 Contributor
13 Posts

See blackboard.util.FileUtil - pay particular attention to the encodeFileName and findEncodedFileName methods.

All Replies

Top 10 Contributor
9 Posts

Files with spaces, multibyte characters are hex encoded. Remove the leading ! and hex decode the "46726f6d2043616d657261203134204a616e20303031" to recover the original name "From Camera 14 Jan 001"

Top 10 Contributor
13 Posts

See blackboard.util.FileUtil - pay particular attention to the encodeFileName and findEncodedFileName methods.

Page 1 of 1 (3 items) | RSS
© 2006-2009 Blackboard Inc. All Rights Reserved. Blackboard, the Blackboard logo, and EduGarage are trademarks
or registered trademarks of Blackboard Inc. in the United States and/or other countries.