Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> upload proszę o pomoc w kodzie
worth-to-see.com
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 17.10.2009

Ostrzeżenie: (0%)
-----


proszę o pomoc, chce żeby odwiedzający strone mogli za jej pomoca wgrywac na server pliki z fotkami - mam takki kod ale wywala mi zebym zrobił CHMOD 777 kotalogu docelowego (jest to zrobione!)

co tu nie gra?

Cytat
$allowed_filetypes = array('.jpg','.gif','.bmp','.png');
$max_filesize = 524288;
$upload_path = './TRV/';

$filename = $_FILES['userfile']['name'];
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);


if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');


if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
die('The file you attempted to upload is too large.');


if(!is_writable($upload_path))
die('You cannot upload to the specified directory, please CHMOD it to 777.');


if(move_uploaded_file($_FILES['userfile']['tmp_name'],$upload_path . $filename))
echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>';
else
echo 'There was an error during the file upload. Please try again.';
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 17:50