file_put_contents не работает на PHP версии 5.4 и выше

Следующий код не работает на PHP версии 5.4 и выше на моем сервере из-за устаревания. Однако изменение версии PHP до 5.3 или ниже с помощью MultiPHP Manager работает нормально.

Что я должен сделать со следующим кодом, чтобы он работал для обновленных версий?

    <?php
//blog.theonlytutorials.com
//author: agurchand

if($_POST){
//get the url
$url = $_POST['url'];

//add time to the current filename
$name = basename($url);
list($txt, $ext) = explode(".", $name);
$name = $txt.time();
$name = $name.".".$ext;

//here is the actual code to get the file from the url and save it to the uploads folder
//get the file from the url using file_get_contents and put it into the folder using file_put_contents
$upload = file_put_contents("uploads/$name",file_get_contents($url));
//check success
if($upload)  echo "Success: <a href='uploads/".$name."' target='_blank'>Check Uploaded</a>"; else "please check your folder permission";
}
?>

<html>
<head><title>Theonlytutorials - Simple File Upload from URL Script!</title></head>
<body>
<h3>Theonlytutorials.com - Very Simple File Upload from URL Script!</h3>
<form action="" method="post">
Your URL: <input type="text" name="url" />
</form>
</body>

</html>

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector