开发者

How to upload hard coded image in php

I want to upload a particular image without using upload controls. My problem is that I am not able to pass the hard coded image path to upload.php.

upload.php:

<?php

  //i want to assign my image path here can any one tell me how to do that
  echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  echo "Type: " . $_FILES["file"]["type"] . "<br />";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  echo "Stored in: " . $_FILES["file"]["tmp_name"];

开发者_StackOverflow社区?>


When you post a file, it get's uploaded to a temp folder wich is somewhere in your server. It depends on your server configuration. If it is a shared server, the temp folder might be shared with other users as well. What you need to do is use the php function move_uploaded_file($temp_file, $destination) to copy it to the new path. If you don't do this, the temp file will get eventually deleted.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜