php - My script can't access file at temporary location -
i have html asks username, password , image file.
then utilize script upload snapchat story:
<?php $target_dir = "uploads/"; $target_dir = $target_dir . basename( $_files["uploadfile"]["name"]); $uploadok=1; if (move_uploaded_file($_files["uploadfile"]["tmp_name"], $target_dir)) { echo "the file ". basename( $_files["uploadfile"]["name"]). " has been uploaded."; } else { echo "sorry, there error uploading file."; } $user = $_post['user']; $pass = $_post['pass']; $img = $_files["uploadfile"]["tmp_name"]; require_once("src/snapchat.php"); $snapchat = new snapchat($user, $pass); $id = $snapchat->upload(snapchat::media_image,file_get_contents($img)); $snapchat->setstory($id, snapchat::media_image, 10); ?>
but not work! keeps saying:
warning: file_get_contents(/tmp/phpco1pki) [function.file-get-contents]: failed open stream: no such file or directory in /home/u753295385/public_html/run_command.php on line 18
there's i'm forgetting. if help me that'd awesome!
that's because file not there more - moved it:
if (move_uploaded_file($_files["uploadfile"]["tmp_name"], $target_dir)) {
this function moves file temporary directory somewhere else. either not move, or utilize target location - $target_dir
.
i don't know snapchat is, if you're using contents of file, don't have move @ all. check $_files["uploadfile"]["error"]
, pass temporary name:
$id = $snapchat->upload(snapchat::media_image,file_get_contents($_files["uploadfile"]["tmp_name"]));
php file-upload upload file-get-contents snapchat
No comments:
Post a Comment