Gdzie i jak wpisać adres serwera, np. mojserver.com/upload/ aby uploadowało pliki właśnie do tego katalogu, a nie do katalogu tam gdzie jest skrypt? (skrypt mam w mojserwer.com/test/ a chciałbym aby pliki znajdowały się po wrzuceniu w mojserwer.com/upload/)
<?php /************************************************* * Max's File Uploader * * Version: 1.0 * Date: 2007-11-26 * ****************************************************/ class maxUpload{ var $uploadLocation; /** * Constructor to initialize class varaibles * The uploadLocation will be set to the actual * working directory * * @return maxUpload */ function maxUpload(){ } /** * This function sets the directory where to upload the file * In case of Windows server use the form: c:\temp * In case of Unix server use the form: /tmp/ * * @param String Directory where to store the files */ function setUploadLocation($dir){ $this->uploadLocation = $dir; } function showUploadForm($msg='',$error=''){ ?> <div id="container"> <div id="header"><div id="header_left"></div> <div id="header_main">Max's File Uploader</div><div id="header_right"></div></div> <div id="content"> <?php if ($msg != ''){ } else if ($error != ''){ } ?> <form action="" method="post" enctype="multipart/form-data" > <center> <label>File: <input name="myfile" type="file" size="30" /> </label> <label> <input type="submit" name="submitBtn" class="sbtn" value="Upload" /> </label> </center> </form> </div> <div id="footer"><a href="http://www.phpf1.com" target="_blank">Powered by PHP F1</a></div> </div> <?php } function uploadFile(){ $this->showUploadForm(); } else { $msg = ''; $error = ''; //Check destination directory $error = "The target directory doesn't exists!"; $error = "The target directory is not writeable!"; } else { " was uploaded successfully!"; } else{ $error = "The upload process failed!"; } } $this->showUploadForm($msg,$error); } } } ?>