drbigfresh Posted September 26, 2007 Share Posted September 26, 2007 ??? So for two days I've been trying to figure this out, with no luck. I have your typical PHP/MYSQL script that uploads files into a database and then let's you download them. It all works fine. So I go to upload to my host (hostgator) and it all seems to work, but any file I download looks like it is a BAD xerox of the original...Where you can make out some text in the background but it's kind of washed out in color.... I've attached a sample. Has anyone ever seen anything like this before? Ive tried everything, and have no issues with using it on my dev server. I've even checked the size of the files stored in the database between my local server and the hostgator one, and the files are the same size in the database. And what's even weirder, is that the file is also being save locally on the server, and it's totally fine and readable.... [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/70709-completely-perplexed/ Share on other sites More sharing options...
cooldude832 Posted September 26, 2007 Share Posted September 26, 2007 few issues possible. 1) Your max_upload is less than your files, thus it is getting partial files and the trailing end is being cut off 2) Your mysql db isn't large enough thus it can not have large enough Blob's for the data 3) The header generation is corrupt 4) The output is so slow it timesout and shows what it has. Quote Link to comment https://forums.phpfreaks.com/topic/70709-completely-perplexed/#findComment-355423 Share on other sites More sharing options...
drbigfresh Posted September 26, 2007 Author Share Posted September 26, 2007 Just checked, definitely not 1 or 2. Tons of space. The header generation could be corrupt, but it is working fine on my local server, and it is actually sending me a valid file to download, etc... so it makes me think it isn't a header issue. It could be an output problem, although I cant' really figure out why it would be the issue, they are small files that seem to download almost instantly.... FYI, this is the header info I am sending out: header("Content-type: $type"); header("Content-Disposition: attachment; filename=\"$name\""); header("Content-length: $size"); //header("Content-Description: PHP Generated Data"); header("Content-Transfer-Encoding: binary"); header("Cache-Control: private"); // Workarounds for IE weirdness header("Pragma: public"); echo $content; exit; and I've tried just about every variation or tweak in there I could.... Quote Link to comment https://forums.phpfreaks.com/topic/70709-completely-perplexed/#findComment-355461 Share on other sites More sharing options...
chronister Posted September 26, 2007 Share Posted September 26, 2007 Why not just store the files in the filesystem and store the path in the database? Then you don't have to worry about data corruption when it tries to insert it into the database. I have tried to store files in the db with no luck. Store em in the file system and let the db keep track of what's there and all is right with the world. that's my 1.5 cents Nate Quote Link to comment https://forums.phpfreaks.com/topic/70709-completely-perplexed/#findComment-355475 Share on other sites More sharing options...
drbigfresh Posted September 26, 2007 Author Share Posted September 26, 2007 I don't disagree with you, unfortunately the client feels otherwise..... I think I finally solved it. I was running this function on the content of the upload: function SQLSafeData($data) { // Reverse magic_quotes_gpc/magic_quotes_sybase effects on those vars if ON. if(get_magic_quotes_gpc()) { $data = stripslashes($data); } //else { // $data = $data; // } return mysql_real_escape_string($data); } //End Function and somehow removing that and simply running addslashes() on the content seems to have fixed it. Quote Link to comment https://forums.phpfreaks.com/topic/70709-completely-perplexed/#findComment-355645 Share on other sites More sharing options...
cooldude832 Posted September 26, 2007 Share Posted September 26, 2007 magic quotes... Come 6.0 this isn't an issue Quote Link to comment https://forums.phpfreaks.com/topic/70709-completely-perplexed/#findComment-355758 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.