I've been issued with the task of when an e-mail is sent to a specific e-mail address it should upload it to a folder called 'input' I have to check this folder for changes to see if there are any .PDF files in so I can allow them through to be converted to a .DOC file and be stored in another folder called 'output' and then send it back to the user that e-mailed it, where would I start with this?!
2 Answers
You could store the md5 of the folder content in some place (database, file, cookies..) and then if the folder contents change, the md5 will also change.
You can find a function for it here.
3 Comments
kuldeep.kamboj
This seems like a good answer, but how would I do it so that when the user e-mails the file it renames the file dependent on the e-mail it is sent from? I assume I have to do something with POP but I'm not sure what? The last part of e-mailing it back is fine, I'm connected through the SMTP server and using something called mailer to send it back it's just becoming a bit of a pain
Alvaro
That's another different question. Open a new one for it.
you can do something like:
<?php $filename = '/path/to/input_folder/yourfile.pdf'; if (file_exists($filename)) { //do convert to .doc } else { //do something else } ?> 4 Comments
egig
do you want to check the file extension first?
egig
if so, you have to (and it is recommended due to security) check-it before you upload it into 'input' folder.