Jump to content

header('Content-disposition: message); ??


freelance84

Recommended Posts

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);

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.