Jump to content
php.lv forumi

php read from folder


ziedinjsh

Recommended Posts

Tā tad.. uztaisīju šādi:

delete links ir:

<a href='delete.php?file=$file'><img src='misc/delete.png'></a>

delete.php ir šāds:

<?php
$dir = 'upload/uploads'; 
unlink($dir.'/'.$_GET['file']);
?>

 

uzspiežot uz linka man parāda worning:

Warning: unlink(upload/uploads/Cary_Brothers_-_Ride__Blake_Jarrell_Remix_.mp3) [function.unlink]: Permission denied in /home/produc/public_html/mp3/test/delete.php on line 3

 

Kas tur nav riktīgi un vai šo var ielikt vienā failā bez delete.php?

Link to comment
Share on other sites

paprovēju šādi.. vienlaga neiet:

$dir = 'upload/uploads'; 
chmod($dir.'/'.$_GET['file'], 0644);
unlink($dir.'/'.$_GET['file']);

 

Warning: chmod() [function.chmod]: Operation not permitted in /home/produc/public_html/mp3/test/delete.php on line 3

 

Warning: unlink(/Bryan Adams -Please Forgive Me.mp3) [function.unlink]: No such file or directory in /home/produc/public_html/mp3/test/delete.php on line 4

Link to comment
Share on other sites

uz servera.. folderis kur atrodas faili ir 0777 kur? ir problēma\

 

.. tā.. tagad fails izdzēsās, bet parādījās:

Warning: chmod() [function.chmod]: Operation not permitted in /home/produc/public_html/mp3/test/delete.php on line 3

Edited by ziedinjsh
Link to comment
Share on other sites

Zinu sito baigā ņemšanās bij un meklēšanās. Ņem šo skriptu un klapējam šo topiku ciet.

 

<?php
	$url = '/mape1/mape2';
         	$handle = opendir ($url);
echo '<div>';
 while (false !== ($file = readdir($handle))) {
           if($file != "." && $file != ".." && $file != basename(__FILE__)) {
echo '<img style="margin: 5px" border="0" src="'.$url.$file.'" width=1000 height=1000 />';
           }
}
echo '</div>';
?>

Edited by MCWeb.lv
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...