douruobokui58233 2013-06-04 23:41 采纳率: 0%
浏览 237
已采纳

$ _FILES ['file_import'] ['tmp_name'])仅返回文件夹名称但不返回文件名

I have a php web app that I deploy to multiple servers. It works on my local installation as well as every other server I put it on.

But on the current server I'm deploying to, I'm having trouble with all of the file upload features.

When trying to debug it, I realized they are failing when trying to get the finfo(FILEINFO_MIME_TYPE).

Example: a form has an upload field called "file_import". I put in the following line of code into the shared import function.

die(print_r($_FILES['file_import']));

On my local installation, it returns:

Array
(
    [name] => US Capital Division.csv
    [type] => application/vnd.ms-excel
    [tmp_name] => C:\wamp\tmp\php3B7C.tmp
    [error] => 0
    [size] => 1268
)
1

Uploading the same file on the current deployment it returns:

Array
(
    [name] => US Capital Division.csv
    [type] => application/vnd.ms-excel
    [tmp_name] => /tmp/phpJdRZDW
    [error] => 0
    [size] => 1268
)
1

They both say they have no errors, but the deployment server only gives the folder name for the tmp_name value, while the local installation gives the temp folder AND file name. So when my code try $_FILES['file_import']['tmp_name'] it errors.

I feel like it has to be server setting or folder setting, but I can't find anything on the web as to what would cause that.

Thanks.

  • 写回答

1条回答 默认 最新

  • duanaigua4033 2013-06-05 00:21
    关注

    Actually, the phpJdRZDW inside [tmp_name] => /tmp/phpJdRZDW is not a folder... It's just a temporary file name while the file sits inside the /tmp/ folder (waiting to be moved and [usually] renamed).

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

报告相同问题?

悬赏问题

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