Welcome, Guest. Please login or register.
June 19, 2013, 06:31:10 AM
Pages: [1]   Go Down
  Print  
Author Topic: File handling with PHP  (Read 134 times)
Wrawrat
Ace

Posts: 6,818

Join Date: Sep, 2002


« on: July 08, 2005, 04:11:55 PM »

File handling with PHP
Logged
Wrawrat
Ace

Posts: 6,818

Join Date: Sep, 2002


« Reply #1 on: July 08, 2005, 04:11:55 PM »

This forum is rather dead, but I figure it could get more lively if we add some questions... so here we go.

I need some help with the handling of a file uploaded via an HTML form. First of all, I must identify if the file is a PDF or a RTF. Everything else should be rejected. Checking the extension is an idea but MS Word is stupid and will still open a renamed MS-Word document (e.g. a .doc with an .rtf extension) as a MS-Word document. DOC are a no-no because of security... and because the client doesn't want them.

Once it has been validated, the file must be mailed to an user. That is the tricky part, since I don't have any PEAR classes on the server. The admin is out for a week and I need to finish this project for wednesday. I have seen some documentation on BASE64 but I am not really familiar with it

Any tip?
Logged
Pyro-Chris
Ace

Posts: 1,223

Join Date: May, 2005


« Reply #2 on: July 09, 2005, 09:16:28 PM »

lol do you still need help with it? i suggest putting it in offtopic lol
Logged
Wrawrat
Ace

Posts: 6,818

Join Date: Sep, 2002


« Reply #3 on: July 12, 2005, 02:20:33 PM »

Given that I am pissing off people since I move their topics to the proper forum...

I have almost finished the mail part. I will post my code snippet once I have finished. As for the detection, I'm still trying to find a solution.
Logged
Cash
Ace

Posts: 3,169

Join Date: May, 2002


« Reply #4 on: July 13, 2005, 05:08:43 PM »

quote:

Originally posted by: Wrawrat
Given that I am pissing off people since I move their topics to the proper forum...

I have almost finished the mail part. I will post my code snippet once I have finished. As for the detection, I'm still trying to find a solution.


Could try checking the extension and the beginning of the file to verify.  This is the first line of a PDF:

%PDF-1.5

Adobe should have a detailed specification.  There should be something similar for RTF.
Logged
Wrawrat
Ace

Posts: 6,818

Join Date: Sep, 2002


« Reply #5 on: July 18, 2005, 06:44:22 PM »

Aye, good idea, but specifications ain't always free... So far, I have chosen the easy way (detecting the extension) since we decided to log the IPs in case of abuse but scanning headers would be something to consider. The deadline was extended by one week so I might try this if I have the time.

Thanks!
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: