开发者

zend, Zend_File_Transfer_Adapter_Http() not moving files

开发者 https://www.devze.com 2023-03-26 03:50 出处:网络
I am using my iPhone app to post images to a page in my Zend application.On the landing page, my code is as follows:

I am using my iPhone app to post images to a page in my Zend application. On the landing page, my code is as follows:

$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination('users/images/');
$file_name = $upload->getFileName('photo', false);
$upload->receive();

This page will accept all types of files (for testing purposes) for now.

If I use a Zend_Form to post an image to this page, it uploads to the destination folder (chmod 777) correctly, and the file transfers. If I use the iPhone app to post data, it doesn't work; it just uploads the folder to the server's /tmp/ folder and it isn't transferred to the destination folder I declared.

Why is this? It should do the same thing as someone uploading via the form. The iPhone app posts all files sucessfully but Zend or the server doesn't want to transfer it from the tmp folder to 'users/images/' folder in my public folder.

If I echo $upload->getFileName() and upload via my form in my Zend app, it prints 'user/images/myphoto.jpg' but if my iPhone app posts, it prints '/tmp/myphoto.jpg'

Why isn't it transferri开发者_JAVA百科ng my photo to the given destination when I do not use the Zend_Form?


The one thing that comes to mind is that Zend_Form::isValid I believe handles the actual movement of the file from the temp directory to the destination directory. I am wondering if your form validation is failing in some way?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号