When you upload a file, this is being stored by php in temp file. You 
can access that temp file with
$_FILES['fieldname']['tmp_name'].
In cake you can use $this->data['Modelname']['fieldname']['tmp_name'].

In order to know where to put the file and where to retrieve it, I use 
the db.
I have a table with id, name, created, modified.
When my script allows a file to be uploaded, the save() method will add 
a new row in the table.
I just use the id of that row as name for the file.

So fielsystem and db are sync, and and I can just think at my files like 
db data, because a file is
always stored in a folder named after its model name, and the filename 
is always corresponding to a row in the table.
This is a bad explanation for something quite simple ;)

olivvv

[EMAIL PROTECTED] wrote:
> Thanks for all that example code that helps to really reinforce things.
>  So, what is the location of the file before you call the
> move_uploaded_file??  Is this an Apache setting?I guess I am just
> confused as to how it knows where to upload to on the server and then
> knows to retrieve it and then you have to move it from being uploaded
> to actual a place on your server.  I guess that is a layer of security
> so that you can check it out for someone trying to hack by uploading
> malicious stuff.
>
> So, basically uploading files in a form I have to use the
> move_uploaded_file function.  But I can wrap it around a function in my
> app_controller to use frequently.
>
> Amazing that I have done web programming for a couple years now and
> never had to tackle the whole upload a file thing huh?
>
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to