You should first check by is_uploaded_file() and then move it by move_uploaded_file(). It is the only safe way with PHP. These functions goes through bunch of PHP security restrictions instead of normal file functions.
Until move_uploaded_file() called or request finished file is in temp dir with temp name. After move or script exit it is deleted. > Doing the move after the is_uploaded_file puts the file in the right > place, but makes the is_uploaded_file return false. It only means that you actually do move_uploaded_file() before is_uploaded_file() somewhere. On Aug 27, 2:42 am, MrMeikel <[email protected]> wrote: > Hi, > > I haven't done any file upload handling for a long time in php, so > maybe I am missing something quite obvious here. > > I have a simple upload form using the form helper that seems to work. > My controller then calls a model function called "data_upload" which > is responsible for moving the uploaded file using move_uploaded_file. > This suceeds and I have now have the chosen file in my /files/ folder > - everything seems fine. > > However, my Model validation calls on the php method > "is_uploaded_file" which is passed the same file path/name as the > move_uploaded_file - which returns false. I also cannot find the > suggested temp file anywhere on my computer (local server). > > Removing the move_uploaded_file makes is_uploaded_file return true, > but still I cannot find the temp file anywhere. Doing the move after > the is_uploaded_file puts the file in the right place, but makes the > is_uploaded_file return false. > > I have checked php.ini and file uploads are on, and the tmp file is > the one where I am looking - I also checked my whole C:\ for any > possible temp file and found nothing. > > I assume this is something to do with caching uploads? I am running > xampp on windows 7. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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?hl=en -~----------~----~----~----~------~----~------~--~---
