
08-12-03, 04:10 AM
|
|
Newbie Coder
|
|
Join Date: Aug 2003
Location: Copenhagen, Denmark
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
File download upload
I urgently need a PHP script where you can:
Download a file and at the same time make it impossible for other to download the same file before it has been uploaded and released by the 'uploader' again.
In this way you can secure that only one can make changes to the file at a time.
I have tried several uploader/downloader and file manager PHP scripts - but none has the above described functionality.
Please help me.....
__________________
Ole :-)
|

08-12-03, 05:14 AM
|
 |
Newbie Coder
|
|
Join Date: Aug 2003
Location: Manchester, UK
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i suppose one cruel way would be to have the upload script chown the folder to a user like 'ftp', and then once the file is uploaded successfully it changes the ownsership of the folder back to what it was previously. Only problem is the error that the user gets will be a little unfriendly.
|

08-12-03, 05:18 AM
|
 |
Newbie Coder
|
|
Join Date: Aug 2003
Location: Manchester, UK
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Aha! Got a better thought!
Why don't you store the file in the database itself (assuming the file isn't huge) and have a column in the database named 'locked'.
then, the upload script would set the value of 'locked' to, say, 1. this would mean that the file itself is locked. the download script could have a bit of code that checks for the value of 'locked' before it starts the downloaded...i.e download if value = 0, or abort if value = 1.
the upload script would basically change the value to 1....upload the file, then change the value back to 0 so it can be downloaded again.
only issue is determining whether or not someone is already downloading the file, but there are ways round that.
i might have time to write the code if you need help.
|

08-12-03, 07:23 AM
|
|
Newbie Coder
|
|
Join Date: Aug 2003
Location: Copenhagen, Denmark
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear kickinhard007
Aha ! ..your last thought sounds very sophisticated!!
But, as I am quite new in PHP programming, I don't have a clue how to make the code.
However, I have already implemented several (more and less) modified PHP scripts on my web server - also including MySQL DB.
...so every help is very much appreciated.
Rgds.
__________________
Ole :-)
|

08-12-03, 07:47 AM
|
 |
Newbie Coder
|
|
Join Date: Aug 2003
Location: Manchester, UK
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i will try and spare half an hour to write some code for you, bear with me :-)
|

08-13-03, 03:34 AM
|
|
Newbie Coder
|
|
Join Date: Aug 2003
Location: Copenhagen, Denmark
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear Kickinhard007
...how are you today ?
I just want to check if you have forgotten me ;-)))) - and I should keep on searching.
(I looked at some of your other brilliant responses yesterday. I must admit that I am quite impressed about you lever of expertise !!)
Rgds.
__________________
Ole :-)
|

08-13-03, 03:43 AM
|
 |
Newbie Coder
|
|
Join Date: Aug 2003
Location: Manchester, UK
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
howdy ole!
you wouldn't think that i've only been programming php properly for a month! ha ha! i will be writing the code today for you, should have it done by this afternoon!
Thanks for the kind comments, i've been using hotscripts for ages so i thought i'd help out! :-)
|

08-13-03, 04:47 AM
|
|
Newbie Coder
|
|
Join Date: Aug 2003
Location: Copenhagen, Denmark
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Fantastic!!
...I don't know if it is relevant - but here is some further information:
- The file, which needs to be uploaded/downloaded, is an EXCEL file.
- Yes, as you described one issue is determining whether or not someone is already downloading the file.
- An other issue is how to regulate that only the 'one' who has downloaded the EXCEL file is also allowed to (modify and) upload it again. You might have a person, which has an old version of the EXCEL file, which just try to upload without knowing that another person has downloaded the file in the meantime....
(Of course you can tell the 'subscribers' - that they are only allowed to upload the file if they are the subscriber who also caused the file to be 'locked' - but I think we all know the level of ignorance user’s might have.....).
...ok, my explanation might not be that good as my language is Danish – not English ;-))) - but hope you got my point.
Rgds.
__________________
Ole :-)
|

08-13-03, 08:06 AM
|
|
Newbie Coder
|
|
Join Date: Aug 2003
Location: Copenhagen, Denmark
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Just one more comment:
- I expect the EXCEL file size to be between 100Kb and 500Kb i total.
Rgds.
__________________
Ole :-)
|

08-13-03, 12:00 PM
|
 |
Newbie Coder
|
|
Join Date: Aug 2003
Location: Manchester, UK
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ole, i'm working on the script, but work has been very busy today so i'm going to be delayed until tommorrow.
just thought i'd let you know I haven't forgotten! :-)
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|