情况是这样的,我在本地指定的文件夹里有一个图片,我想写一个文件,每当运行这个文件时就自动的把本地的这个图片上传到服务器上,我写了两天没有实现,望哪位朋友帮帮忙!先谢了!
解决方案 »
- 如何自动根据注册名生成二级域名 php
- 请问怎么在dedecms里加入一个哀悼版功能呢?
- 关于thinkphp中的widget的开发
- phpMyAdmin
- 不出现地图,怎么根据地址怎样更改坐标?速救!!!!
- 有一个wordpress模版,不能往文章中插入图片,别的模版可以,为什么?
- 付费求助:帮忙解决 title标题调不出问题
- 建站的问题
- 利用JoomFish进行多语言网站设计,需要什么前期工作。求大神指点
- discuz论坛showmessage()函数代码修改
- 高分求PHP如何进行 增 删 改 并且把当前操作步骤生成日志进行保留
- PHP怎么过滤GET或者POST的参数?怎么样才能保证代码不被注入?
换种方式吧。或者把需求描述清楚些
<?php
$filename = 'test.txt';
$somecontent = "Add this to the file\n";// Let's make sure the file exists and is writable first.
if (is_writable($filename)) { // In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
} // Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
} echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle);} else {
echo "The file $filename is not writable";
}
?>
本地还是服务器。
放在服务器的话,似乎就不行了。本地运行的话,可以用ftp的方式,发送到服务器。
或者在服务器 做个上传接口。
你在本地调用,把图片数据发送过去,服务器端保存。
先决条件是你在本地执行php程序
本地模拟客户端把文件读出来,发送过去.这两个文件要比对密钥,只有你自己知道.