duanjing7459 2010-07-09 23:59
浏览 48
已采纳

文件上传在CakePHP中神秘失败

I'm trying to upload a file to my server using the CakePHP file upload form helper.
I am currently running CakePHP 1.3 on my development computer (Mac OSX).
When the form submits, it has in the variables that are passed to the controller its temp name: /var/tmp/name and then its name as the name of the file.
However, when I try to rename the file to a more permanent location, it fails, and if I go to the location, it doesn't exist.

I get these error messages:

Warning (2): move_uploaded_file(Users/chustar/Documents/IMAG0001.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory [APP/controllers/users_controller.php, line 41]
Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move '/private/var/tmp/php98lzsP' to '/Users/chustar/Documents/IMAG0001.jpg' [APP/controllers/users_controller.php, line 41]
Warning (2): Cannot modify header information - headers already sent by (output started at /Library/WebServer/Documents/cake/libs/debugger.php:673) [CORE/cake/
  • 写回答

1条回答 默认 最新

  • dongzan7016 2010-07-10 02:15
    关注

    I get this error a lot when I don't have permissions set properly on the target directory. For the purposes of illustration, I'm going to assume that you're running an Apache web server and that it's running as a user named www. That www user must have write access to the target directory. It's not about what permissions you have, but what permissions the web server user has.

    If you find that not to be the problem, a few more specifics and/or some code may be helpful.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 fluent的在模拟压强时使用希望得到一些建议
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退