dongwujie7477 2011-11-02 16:11
浏览 23
已采纳

下载上传到mysql的文件到服务器目录

I've searched and searched but have not found a script capable of downloading files which are uploaded to my mysql database down to a directory in my server. This is only temporary and once the file has been used it'll need to be disposed of. Got any ideas?

  • 写回答

1条回答 默认 最新

  • douzhi19900102 2011-11-02 16:18
    关注

    I suppose you meant that the file is saved into mysql database like BLOB (binary data)

    $result = mysql_query("select * from tablename where id=XXXX");
         if (mysql_num_rows($result)>0){
         $r = mysql_fetch_array($result,MYSQL_ASSOC);
         file_put_contents($filename,$r['column_blob']);  
       }
    

    I used file_put_contents function that it is binary safe, but there is also fwrite

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

报告相同问题?

悬赏问题

  • ¥15 Linux环境下CA证书更新问题
  • ¥60 微信小程序如何上传QQ聊天文件
  • ¥300 开发的系统遭到无良商家的破解,请问如何防止再次发生,并追回损失
  • ¥15 java代码写在记事本上后在cmd上运行时无报错但又没生成文件
  • ¥15 关于#python#的问题:在跑ldsc数据整理的时候一直抱这种错误,要么--out识别不了参数,要么--merge-alleles识别不了参数(操作系统-linux)
  • ¥15 PPOCRLabel
  • ¥15 混合键合键合机对准标识
  • ¥100 现在不懂的是如何将当前的相机中的照片,作为纹理贴图,映射到扫描出的模型上
  • ¥15 安卓OpenCV人脸识别分类器加载
  • ¥15 魔霸ROG7 pro,win11.息屏后会显示黑屏,如图,如何解决?(关键词-重新启动)