freelance84 Posted June 17, 2011 Share Posted June 17, 2011 With reference to a previous topic: http://www.phpfreaks.com/forums/index.php?topic=336267.0 I have successfully now achieved an online ftp program on my site. The system will only allow the user to download any file which isn't already being worked by any other member of the team. One scenario is still to cover though... Two users click to download and work on the same file at the same. As the table in the mySql database will only allow one entry of any file at any one time, one of these attempts from the two users will fail. The user which succeeds, their attempt will simply run this: header('Content-disposition: attachment; filename='.$theFile); header('Content-type:'.$mimeType); readfile($dirFile); As this returns the browsers dialog box for downloading, the page which they came from is not altered and hence their directory tree remains at the position they were on (which is good as the directory tree is run with ajax, so a page reload takes them back to the start). The user which fails... ideally they need be returned a message in the same style as the download dialog box to keep them in the same position of their directory tree, something which says something like: 'Sorry it appears you and another user tried to download this file at the same time... and they beat you to it'. So, what i was thinking was.. Can I alter the type of "Content-disposition"? After searching google a few things popped up, and php manual a bit too... But does anyone know if i am barking up the wrong tree here and wasting time? Is it possible to do something like: header('Content-disposition: message; title=error'); header('Content-type:message/http); message($errorMessage); Quote Link to comment https://forums.phpfreaks.com/topic/239630-headercontent-disposition-message/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.