Tomasz
|
| Posted: 04/24/2002, 6:57 AM |
|
I use file upload on my pages baed on example found at T&T - it works, but this solution is a little bit confusing: you must create record first, then add picture to it.
Proper solution would be input type=file field inside record form.
Does anybody tried to achieve this in CC without manual edit of php file?
(PHP+tpl)
|
|
|
 |
Alex Alexapolsky
|
| Posted: 04/24/2002, 7:08 AM |
|
As you see , input = file is located in header&footer form ,
you can paste upload form html code into any header&footer section in
CC , be that record or menu.
|
|
|
 |
Tomasz
|
| Posted: 04/24/2002, 7:18 AM |
|
Alex,
As I said I strictly do it that way
but: It creates separate form.
I've asked if it possible to include file field INTO present form
|
|
|
 |
Steve F.
|
| Posted: 04/24/2002, 7:26 AM |
|
Hi,
I modified the ASP version upload to do this and am currently changing the PHP as well. My solution in ASP will differ a bit due to the "HEADER()" functionality in PHP but will be quite similar. Here's what I did...
I had a list of projects in one form on the page, and a list of attachments or "items" in another form. The "insert" link pointed to the page containing the upload form passing along the project_id as a parameter.
The page loads, but before showing any content Inserts a record into the attaachments table (I believe this a pictures table in the example).
When this is complete, I ran a simple query to select the last record inserted by the user (SELECT MAX(item_id) from attachments where added_by =......)
At this point, there is a record in the database for this upload, the project_id it is for, and the person who added it. Now, all we need to do is upload the file.
I put in a simple redirect(ASP version) to the same page, passing the item_id as a parameter, and was able to upload the file associated with the project. Although it appears complex, it really isn't, and everything appears to happen in one quick step to the user. The only difference with PHP is the fact that I may have to tweak the redirect stuff. Once I am done, I'll try post an example in the tips section, but I think I've described the process enough for you get the general idea of what I did.
Steve
|
|
|
 |
|