Re: file upload strange - doesn't appear in filesystem, but can be move_uploaded_file()ed
Just to add to Dr. Loboto's response, from your question, it seems that you're passing the final destination path to is_uploaded_file(). That will not work, as it expects the tmp name (because it will look in the tmp directory). And, as it's already been moved, the tmp file will have been deleted, as already mentioned. On Thu, Aug 27, 2009 at 7:25 AM, Dr. Loboto wrote: > > 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 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: file upload strange - doesn't appear in filesystem, but can be move_uploaded_file()ed
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 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
file upload strange - doesn't appear in filesystem, but can be move_uploaded_file()ed
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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---