944,162 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 18361
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
May 5th, 2005
0

open save dialog box error

Expand Post »
i have a question. my function works in a way that once user clicks the link, the open save dialog box will pop out then the user have a option to choose whether to open or save the mp3 file.

The problem is the save function can wrk meaning if user save the mp3 file and listen, everything is ok. But when the user try to open the file straight away, the mp3 file cannot be open. There will be an error msg. I do not knoe how to go abt to solve this error.

is there a way to enable the user to open the file straight away once the link is clicked? i have try to put a link to the mp3 file but that would result in the user from seeing the location of the mp3 file. I have try to mask the url but then if the user clicks view source, the user would be able to see the location of mp3 file.

Below is the codes that cause the open save dialog box to pop out

[php]

$currentdir = '../mp3';

$filename = "$trackname.mp3";
$pathname = "$currentdir/$filename";

$fr = fopen($pathname, 'r');
$filedata = fread($fr, filesize($pathname));
fclose($fr);

header ( 'Content-Length: ' . filesize ( $pathname ) );
header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=$filename");
readfile($pathname);
[/php]
Similar Threads
Reputation Points: 11
Solved Threads: 1
Light Poster
starsunited is offline Offline
44 posts
since Dec 2004
May 6th, 2005
0

Re: open save dialog box error

Please use [php] tags next time. I have formatted your post.
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
May 6th, 2005
0

Re: open save dialog box error

Your code was missing some quotations as well, so I took the liberty to add them in. You probably just didn't copy and paste the text, right?
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
May 6th, 2005
0

Re: open save dialog box error

thanks. I have found that this error only occurs in IE. i try in firefox. It's ok
Reputation Points: 11
Solved Threads: 1
Light Poster
starsunited is offline Offline
44 posts
since Dec 2004
May 6th, 2005
0

Re: open save dialog box error

Is this 'Open/Save' dialog box that you are talking about a part of your actual script or is it the download manager associated with the browser?
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
May 6th, 2005
0

Re: open save dialog box error

think it's the download manager associated with the browser. it's not part of my script
Reputation Points: 11
Solved Threads: 1
Light Poster
starsunited is offline Offline
44 posts
since Dec 2004
May 6th, 2005
0

Re: open save dialog box error

Quote originally posted by Gary ...
Your code was missing some quotations as well, so I took the liberty to add them in. You probably just didn't copy and paste the text, right?
i did copy n paste though. wat are quotations by the way?
Reputation Points: 11
Solved Threads: 1
Light Poster
starsunited is offline Offline
44 posts
since Dec 2004
May 6th, 2005
0

Re: open save dialog box error

Quote originally posted by starsunited ...
i did copy n paste though. wat are quotations by the way?
Well for [php] $currentdir = '../mp3'; [/php] it used to be [php] $currentdir = '../mp3;[/php]
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
May 6th, 2005
0

Re: open save dialog box error

Do you have a link to the live script?
Team Colleague
Reputation Points: 53
Solved Threads: 5
PHP/vBulletin Guru
Gary King is offline Offline
360 posts
since Nov 2003
May 6th, 2005
0

Re: open save dialog box error

you mean the result or wat?
Reputation Points: 11
Solved Threads: 1
Light Poster
starsunited is offline Offline
44 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Selecting only one day from week
Next Thread in PHP Forum Timeline: about time??





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC