douhuigang9550 2010-08-11 11:42
浏览 139
已采纳

如果在php.ini文件中禁用allow_url_fopen,则使用备用方法

My application was working fine but I don't know how suddenly allow_url_fopen set OFF in my php.ini , there is php.ini file in my ftp dir but when I execute phpinfo(); it gives all php.ini configuration information.I dont know how to set this ON.can anybody tell me the alternate way to my code-

$image_name=$unq.'.'.$extension;
$newname="album/".$image_name;
$copied = copy($_FILES['image']['tmp_name'], $newname); // here i get error

error: Warning: copy(album/6911139.jpg) [function.copy]: failed to open stream: Permission denied in D:\Hosting\6448289\html\upload.php

URL file-access is disabled in the server configuration in D:\Hosting\6448289\html\upload.php on line 112

please suggest me any alternat method. and is there any any command that I will execute and allow_url_fopen` will set ON ??

  • 写回答

1条回答 默认 最新

  • duangan1945 2010-08-11 11:57
    关注

    Copying an uploaded file to another location on the web server should never involve an URL. Not sure what's going wrong here - I can't see an URL anywhere.

    Anyway, you should use move_uploaded_file() for this, not copy(). Try whether that works better.

    Also try using an absolute path instead of the relative album/.....

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

报告相同问题?

悬赏问题

  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目