Forums

PHP

This topic is locked

Application flow design help

Posted 02 Sep 2003 19:11:54
1
has voted
02 Sep 2003 19:11:54 James Johnson posted:
Hi,
I'm fairly new to PHP and Classes and am building a site that allows user to place online ads for things they want to sell. I'm using the PurePHP upload extenstion to upload the image to the appropriate folder.

My question is this. The ad is not inserted into the database until payment has been made. How should I handle the uploading of the image?

1. If the image has already been uploaded, what is the name of the variable returned when an image has been uploaded.
2. Should I assume the payment will go through, upload the file, then if payment fails, delete the image from the folder?
3. Store the image name in a variable, then upload the file after payment has been made?

So, what I need to know is, what is the variable name of the image *before* and *after* the upload process.

Thanks,
James

Replies

Replied 02 Sep 2003 19:29:04
02 Sep 2003 19:29:04 Andrew Highfill replied:
Not sure what you mean by variable name but try a conditional behavior. There is a good MM extension called <b>PHP Show If Recordset Field Condition Is True</b> if you don't know how to write it yourself.

What I do I do because I like to do.
Replied 17 Sep 2003 17:01:26
17 Sep 2003 17:01:26 Julio Taylor replied:
Hi James,

It would be far too complicated to upload the image after payment, where would you keep the image?

The best thing to do is upload the image, and include a payment status field and an upload datestamp.

Set yourself a payment limit (e.g. 14 days) and set yourself a script that will delete the record and image if the 'payment status' field is still sdet to 0. This will make sure that you clean up unpaid applications, but will ensure the image is already on the server waiting to be diplayed upon payment.

I hope that helps.

------------------------
Julio

PHP | MySQL | DWMX

ICQ: 19735247
MSN:

Reply to this topic