Solved

How do I show a file is checked out?

Posted on 2002-06-19
10
121 Views
Last Modified: 2013-12-24
I'm using cffile to upload files to a folder, and I am writing the data on the files to a db table.

Now I want to institute some kind of check in, check out system for the files.  Does anyone have any ideas on how I should do this?
0
Comment
Question by:g118481
  • 4
  • 4
  • 2
10 Comments
 
LVL 5

Expert Comment

by:nathans
Comment Utility
You are going to shoot me but why do not add a field for the id of who checked it out and make it 0 when it is checked back in.  This way you will know who checked out the file as well as the fact it is checked out?

Plus that way you can have an admin who can see if the person who checked out the file is on vacation or left work without checking it back in... they can then check it back in.

Is this what your wanting? or something more?

0
 
LVL 1

Author Comment

by:g118481
Comment Utility
nathans,

You raised a very good point.
I will have to work on that aspect after I get my primary task figured out

Which is, how do I or what mechanism do you suggest I use to check out the file?  Right now in test I have a link to the document, and they would be able to download this document there.  Also, the update(edit) form allows them to update an existing document.  How can I write a 1 or 0 to the checked out field, and then the checked in field?  How will it know?
0
 
LVL 19

Expert Comment

by:cheekycj
Comment Utility
what is the purpose of this.. do you want to lock down a file completely when a user has downloaded it until they upload/update it again or just for the duration of the upload/update.

CJ
0
 
LVL 1

Author Comment

by:g118481
Comment Utility
yes, I need to be able to lock the upload/update function when someone is working on a document.
0
 
LVL 19

Expert Comment

by:cheekycj
Comment Utility
I am assuming that the site requires authentication?

CJ
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 5

Expert Comment

by:nathans
Comment Utility
Sorry to sound bad but do you know how to update a database using SQL?

If so then simply

<cfquery name="qry" datasource="dsn">
update mytable
Set
  Checkout=1
</cfquery>

Done... now don't allow downloads of the ones with Checkout equal 1


On upload of the new version...

<cfquery name="qry" datasource="dsn">
update mytable
Set
  Checkout=0
</cfquery>

Done... now allow downloads of the ones with Checkout equal 0


Am I missing something? or is this the answer? or do you need more?  Are you meaning in Studio or from your web App?





0
 
LVL 1

Author Comment

by:g118481
Comment Utility
cheekycj,

yes, the web app will do authentication for upload/update of files.

nathans,

my question is based more around the framework for applying this procedure to the web app.

The obstacle I need to overcome is how will the db table know the file has been downloaded?  At first sight this may be a silly question to you.  However, listen to this scanario.

The user can click on a link to each file and download it. Then they can go to the upload page and upload or update that same document without ever checking it out.

How do I place a query to change the new field (checkout) in the table to checked out when the user clicks on the link to the file?  The links are simply a listing of the files in the repository that have been uploaded.

How do I overcome this?
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 50 total points
Comment Utility
you will have to trigger the DB update when the file is downloaded.

your links will be like:

<a href="checkout.cfm?file=filename.doc">Click to download</a><br>


checkout.cfm will look like:

<cfif isdefined("URL.file")>
    <!--- put query here to update flag to check out file --->
    <CFHEADER NAME="Content-Disposition" VALUE="filename=#URL.file#">
    <cfcontent type="attachment" file="/path/to/downloads/#URL.file#">
</cfif>

Does that make sense?

CJ

0
 
LVL 1

Author Comment

by:g118481
Comment Utility
cheekycj,

your framework works perfect.
thanks for your time.
0
 
LVL 19

Expert Comment

by:cheekycj
Comment Utility
Glad I could help and thanx for the "A".

CJ
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now