Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
tommyb
Hangin' Around



Joined: May 31, 2006
Posts: 49

PostPosted: Wed Jun 20, 2007 7:48 am Reply with quote

Hi,

I'm currently working on a script that uses readfile to open documents outside of the web root that are all located in the same folder/path.

The script sends the correct headers for the type of document, and I have triple checked all files are in the correct location.

The folder only contains excel(.xls), word (.doc) and pdf(.pdf) files.

Now the problem I am having is that when I go to download a word document it just appears as a blank document. xls and pdf are working fine and appearing as they should. I have googled this problem loads but am un able to find anything that provides a suitable answer (adding extra heaer lines in, changing the application/msword mime type to octet-stream) and its beginning to get rather frustrating Evil or Very Mad

Has anyone else ever come across a similar problem or would know of a resolution to this?

EDIT---On further investigation into this I believe that it may be somewhere in the upload of these files that is having an adverse effect on the contents of the file. Why this would only happen on a word document I have no idea but when I downloaded the file via ftp. it just contained random characters. The files are not uploaded via ftp but by another ftp script that uses is_uploaded_file and move_uploaded_file and I cannot see anything that would effect the upload.

Many Thanks
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Wed Jun 20, 2007 11:42 am Reply with quote

Have you verified that your ftp script is sending the files as binary and not ascii? Have you tried manually ftp'ing them via your ftp client and does that work? That would narrow the problem down considerably.
 
View user's profile Send private message
tommyb







PostPosted: Wed Jun 20, 2007 11:45 am Reply with quote

Hi Raven,

Out of everything i checked that was the one thing I forgot Embarassed

I wont be able to check until tomorrow now but thanks for the suggestion. I'll post back tomorrow.

many thanks
 
tommyb







PostPosted: Thu Jun 21, 2007 1:52 am Reply with quote

Hi,

I've uploaded a file via ftp as you suggested and i am still getting the same issue. The files just come up totally empty. Whats weird is the file sizes are shown as what they should be and not 0kb. Sorry in my 2nd post I noticed I said they were uploaded by an ftp script. I meant to say they were uploaded using a normal php upload script using is_uploaded_file and move_uploaded_file.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©