PEAK XOOPS - Re: XoopsMediaUploader in englishin japanese

Re: XoopsMediaUploader

List posts in the topic

question Re: XoopsMediaUploader

msg# 1.1.1
depth:
2
Previous post - Next post | Parent - Children.1 | Posted on 2005/8/16 0:43
FutureSpy  伍長 From: 世界のどっかで  Posts: 70
GIJOE, thanks for your reply.

I'm not sure if you meant -that- by graphics, but let's try:

(1) Form
http://www.polarhome.com:793/~rakuen/screen1.jpg
1. You fill in the form and select the file to upload, then it sends the form and upload the file to a temporary folder (in this case modules/mail/attachments).

====

(2) Confirmation Screen
http://www.polarhome.com:793/~rakuen/screen2.jpg
1. The file is stored and checked by a copy of XoopsMediaUploder class (MailMediaUploader).
2. If the file is okay, it lets you send the e-mail. Otherwise, if it's a invalid file, it deletes using unlink() and not let you hit the Submit button.
3. When you hit the submit button, it sends the form plus the file (if any attachments) and deletes or not the file (defined by xoopsConfig) through unlink().


The problem lies here. Let's say someone fills in the form and upload a file. It sends the file and it's okay, ready to be sent. Then he gives up and close the browser window. The file will still be stored in the folder modules/mail/attachments. I could just get it to run a cronjob to clean the folder or get it to run everytime a form is sent, but I wanted to keep a copy of all attachments in the folder just like I keep a copy in the DB of every message sent.

So I wanted it to check the file first before storing it on the attachments folder. But when I use fetchMedia without upload() just like that:
if($uploader->fetchMedia($_POST['xoops_upload_file'][0])){
it's unable to check whether the extension/MIME type is allowed or the size is inside the limit.

The only thing I came up with was having it to upload to a temp folder. If the file is okay keep it there, otherwise delete it. Then, when the user hits the submit button, if the e-mail is sent successfully, move the file to another folder where the backup'ed attachments will be stored, and clear the temp folder (just to get rid off the files uploaded by someone but not sent successfully). Is there any better idea?


I'm sorry if it's not very clear again. If so, let me know and I'll try to draw a scheme of it.

I'll take a look at $_FILES later. ^^

Thanks again!
-Yuji
Votes:8 Average:0.00

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!