User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 392,056 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,259 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 9281 | Replies: 14
Reply
Join Date: Dec 2004
Location: Singapore
Posts: 44
Reputation: starsunited is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
starsunited's Avatar
starsunited starsunited is offline Offline
Light Poster

open save dialog box error

  #1  
May 5th, 2005
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]
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: open save dialog box error

  #2  
May 6th, 2005
Please use [php] tags next time. I have formatted your post.
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: open save dialog box error

  #3  
May 6th, 2005
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?
Reply With Quote  
Join Date: Dec 2004
Location: Singapore
Posts: 44
Reputation: starsunited is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
starsunited's Avatar
starsunited starsunited is offline Offline
Light Poster

Re: open save dialog box error

  #4  
May 6th, 2005
thanks. I have found that this error only occurs in IE. i try in firefox. It's ok
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: open save dialog box error

  #5  
May 6th, 2005
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?
Reply With Quote  
Join Date: Dec 2004
Location: Singapore
Posts: 44
Reputation: starsunited is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
starsunited's Avatar
starsunited starsunited is offline Offline
Light Poster

Re: open save dialog box error

  #6  
May 6th, 2005
think it's the download manager associated with the browser. it's not part of my script
Reply With Quote  
Join Date: Dec 2004
Location: Singapore
Posts: 44
Reputation: starsunited is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
starsunited's Avatar
starsunited starsunited is offline Offline
Light Poster

Re: open save dialog box error

  #7  
May 6th, 2005
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?
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: open save dialog box error

  #8  
May 6th, 2005
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]
Reply With Quote  
Join Date: Nov 2003
Location: Toronto, Canada
Posts: 354
Reputation: Gary King will become famous soon enough Gary King will become famous soon enough 
Rep Power: 6
Solved Threads: 5
Colleague
Gary King's Avatar
Gary King Gary King is offline Offline
PHP/vBulletin Guru

Re: open save dialog box error

  #9  
May 6th, 2005
Do you have a link to the live script?
Reply With Quote  
Join Date: Dec 2004
Location: Singapore
Posts: 44
Reputation: starsunited is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
starsunited's Avatar
starsunited starsunited is offline Offline
Light Poster

Re: open save dialog box error

  #10  
May 6th, 2005
you mean the result or wat?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 11:40 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC