Chciałbym wstawić na stronkę możliwość wysłania plików na serwer na którym stoi stronka. php znam w bardzo małym stopniu. Udało mi się odnaleźć kod, lecz jest z nim błąd.
Błąd jest następujący
<?php //-- SMTP Mail Function By Aditya Bhatt if(isset($_POST['SubmitFile'])){ $myFile = $_FILES['txt_file']; // This will make an array out of the file information that was stored. $file = $myFile['tmp_name']; //Converts the array into a new string containing the path name on the server where your file is. $myFileName = basename($_FILES['txt_file']['name']); //Retrieve filename out of file path $destination_file = $_REQUEST['filepath'].$myFileName; #"/developers/uploadftp/aditya/".$myFileName; //where you want to throw the file on the webserver (relative to your login dir) // connection settings $ftp_server = trim($_REQUEST['serverip']); //address of ftp server. $ftp_user_name = trim($_REQUEST['username']); // Username $ftp_user_pass = trim($_REQUEST['password']); // Password #print_r($conn_id); if ((!$conn_id) || (!$login_result)) { // check connection // wont ever hit this, b/c of the die call on ftp_login "; exit; } else { // echo "Connected to $ftp_server, for user $ftp_user_name "; } $upload = ftp_put($conn_id, $destination_file, $file, FTP_BINARY); // upload the file if (!$upload) { // check upload status "; } else { "; } ftp_close($conn_id); // close the FTP stream } ?> <html> <body> <form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> Server IP Address: <input name="serverip" type="text" id="serverip" size="15" value=""/> Server Username: <input name="username" type="text" id="username" size="15" value=""/> Server Password: <input name="password" type="text" id="password" size="15" value=""/> Server File Path: <input name="filepath" type="text" id="filepath" size="35" value=""/> Please choose a file: <input name="txt_file" type="file" id="txt_file" tabindex="1" size="35" onchange="txt_fileName.value=txt_file.value" /> <input name="txt_fileName" type="hidden" id="txt_fileName" tabindex="99" size="1" /> <input type="submit" name="SubmitFile" value="Upload File" accesskey="ENTER" tabindex="2" /> </form> </body> </html>
Kod
Parse error: syntax error, unexpected T_STRING in /var/www/sites/yoyo.pl/q/u/quppe/index.html on line 33
Strona stoi na yoyo, jest obsługa php i mysql. Czy mógłby mi ktoś poprawić ten kod ? Mam też darmowy serwer zagraniczny na który przerzucę całość jak będzie gotowa.Pozdrawiam
Naprawdę nikt nie zna odpowiedzi na to pytanie... ?