Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Jak stworzyć upload plików poprzez stronę?
#1
witam,
mam pytanie. Czy posiadając serwer www na homie mogę jakoś zrobić na nim ftp? tak zeby ludzie mogli tam wrzucać pliki przez moja stronę www? jeżeli nie to jak to zrobić.
z góry dzięki za pomoc
Odpowiedz
#2
Możesz zainstalować gotowy skrypt uploadu. Link: http://skrypty.webpc.pl/index37.html
Odpowiedz
#3
DoGeR napisał(a):Możesz zainstalować gotowy skrypt uploadu. Link: http://skrypty.webpc.pl/index37.html

Wszystko ok, tylko nie umiem tego skonfigurować. wyskakuje mi cały czas błąd "Somthing is wrong with uploading a file". proszę o pomoc, ponizej kod którego użyłem:
Kod:
<?php

$site_name = $_SERVER['HTTP_HOST'];
$url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
$url_this =  "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

$upload_dir = "upload_files/";
$upload_url = $url_dir."/upload_files/";
$message ="";

//create upload_files directory if not exist
//If it does not work, create on your own and change permission.
if (!is_dir("upload_files")) {
    die ("upload_files directory doesn't exist");
}

if ($_FILES['userfile']) {
    $message = do_upload($upload_dir, $upload_url);
}
else {
    $message = "Invalid File Specified.";
}

print $message;

function do_upload($upload_dir, $upload_url) {

    $temp_name = $_FILES['userfile']['tmp_name'];
    $file_name = $_FILES['userfile']['name'];
    $file_type = $_FILES['userfile']['type'];
    $file_size = $_FILES['userfile']['size'];
    $result    = $_FILES['userfile']['error'];
    $file_url  = $upload_url.$file_name;
    $file_path = $upload_dir.$file_name;

    //File Name Check
    if ( $file_name =="") {
        $message = "Invalid File Name Specified";
        return $message;
    }
    //File Size Check
    else if ( $file_size > 500000) {
        $message = "The file size is over 500K.";
        return $message;
    }
    //File Type Check
    else if ( $file_type == "text/plain" ) {
        $message = "Sorry, You cannot upload any script file" ;
        return $message;
    }

    $result  =  move_uploaded_file($temp_name, $file_path);
    $message = ($result)?"File url <a href=$file_url>$file_url</a>" :
              "Somthing is wrong with uploading a file.";

    return $message;
}
?>
<form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post">
  Upload Image<input type="file" id="userfile" name="userfile">
  <input type="submit" name="upload" value="Upload">
</form>
Odpowiedz
#4
Nadaj prawa chmod dla folderu upload_files 666 lub 777
Odpowiedz
#5
jest nadane 777 od początku, to nie to.
Odpowiedz


Podobne wątki…
Wątek: Autor Odpowiedzi: Wyświetleń: Ostatni post
  Jak założyć stronę www samemu dariusz.zbin 19 15,884 31-10-2022, 02:53
Ostatni post: wozniak
  zapłata za stronę Nicorrtiss 22 19,975 17-06-2021, 04:09
Ostatni post: wozniak
  Jak dopasować własną strone do Prestashop Witek7777 0 2,630 06-06-2015, 22:10
Ostatni post: Witek7777
  [CSS][HTML] Jak wycentrować strone Witek7777 3 4,625 27-05-2015, 14:43
Ostatni post: Kartofelek
  Jak stworzyć własną prezentację (magazyn) Damian M 5 5,423 25-11-2014, 20:07
Ostatni post: ironmaster

Skocz do:


Użytkownicy przeglądający ten wątek: 1 gości
Sponsorzy i przyjaciele
SeoHost.pl