Jump to content

Help! Was working...now isnt!!


spikypunker

Recommended Posts

Hey guys, have asked a few questions recently and everyones been a GREEEAT help.

 

Recently posted http://www.phpfreaks.com/forums/index.php/topic,238039.msg1108811.html#msg1108811 topic and got it all working great.

 

HOWEVER, today i phoned up my hosters and requested the POST limit of my site to be increased to allow people to upload past the 8mb limit. The guy did this and for it to work he reset my server. All cool, the limit increased and all was good.

 

BUT i went back to trying the force download and it's now not passing correctly to the force download. The page gets sent the value of the file for example, song.mp3 then the SAVE AS window pops up and the file is shown and the user is given the choice to save as or open with. This used to work fine but now, the SAVE AS box is only getting the filename, up to any spaces or special characters! For example, "song's.mp3" becomes song another would be "good' song.mp3" would become "good" even the dot becomes a problem for it "song.mp3" becomes "song" so windows saves the file but doesnt know what to do with it cause it doesnt save the extension!! This only happens in Firefox, not IE but it defiantly wasnt doing it before today.

 

It's also affecting uploading of the songs, when you try and save a tracks title to the mysql, it only send the string upto any special characters!!!

 

I've spoken to the tech guys and they dont know whats changed, does anyone have any idea?? THe advice i've been given is to make sure all URL variables are URLencoded, this is ok and i will do this, but it doesnt explain why the server would suddenly start doing this?? Nor why if i echo out the variable, i get the full string displayed on screen but when i try and force the download, the string gets cut short!

 

ANY help would be awesome, cheers again ppl :)

 

Link to comment
https://forums.phpfreaks.com/topic/144976-help-was-workingnow-isnt/
Share on other sites

I am assuming you're using the script here. Can you post some example urls of how you're accessing your script.

 

It is recommended to not have any spaces within urls. You should use an underscore as a replacement, eg file_name.mp3

Hi there, thnks for helping.

 

Yeah i'm using that script and also will spend some time using URLencode and will change my code so it renames the uploaded file when it saves it to the server and replaces the spaces with underscores.

 

However i still dont get how it suddenly stopped working?? Any ideas?

have you tried this:


<?php
$file = $_GET['file'];
$user = $_GET['user'];
header('Content-disposition: attachment; filename=Deserted.mp3');
header('Content-type: audio/mpeg');
readfile('netdog/music/Deserted.mp3', false);
?>

 

this will force both headers. (i didn't read anything you wrote - this is just a common mistake people make with headers - so please excuse me if I'm completely off topic)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.