takashiro1405241549 0 Report post Posted August 26, 2007 I thought there's no trouble with it. But it warned [b]Warning: copy(E:\yufeng\upload1) [function.copy]: failed to open stream: Permission denied in E:\yufeng\upload.php on line 16[/b]What's wrong?<html> <head> <title>uploading files</title> </head> <body> <div> <form enctype="multipart/form-data" name=myform method="post" action="upload.php"> uploading files:<input name="myfile" type="file"> <br /> <input name="submit" value="upload" type="submit"> </form> </div> <?php if(isset($submit)){ if($myfile!= "none"){ $upload_dir = "E:\yufeng\upload1"; $up=copy($myfile,$upload_dir); if($up==1){ print("Files were uploaded successfully!"); } else { print("file uploading failed!"); } unlink($myfile); } else{ print("You haven't select any files!"); } } ?> </body> </html> Share this post Link to post Share on other sites
vujsa 0 Report post Posted August 26, 2007 The script doesn't know what you want to move! When a file is uploaded, it by default goes to the temporary directory with a temporary name. You have to tell the script to move the file from that directory and give it a name for this to work. Also, even if this method were to work, you would still need to assign a value to $myfile like $myfile = $_POST['myfile']; I'm afraid that the very best example of file uploads is at the PHP.net Website. Chapter 38. Handling file uploads This is by far the easiest way to do this and learn the functions required to make it work. This is the method most developers use. The best part of this, the whole script is written for you and ready for modification. vujsa Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted August 26, 2007 (edited) Also you need to set the correct folder rights, you must chmod the folder where you want to upload your files and also the uploaded file itself.Best regards, Edited August 26, 2007 by TavoxPeru (see edit history) Share this post Link to post Share on other sites
Quatrux 4 Report post Posted August 27, 2007 As I see he is using windows OS to copy/move the file, so chmod'ing isn't required, but if it would be a linux machine or similar, changing permissions could be needed, as I know it depends on the configuration. ;] Share this post Link to post Share on other sites
TavoxPeru 0 Report post Posted August 28, 2007 As I see he is using windows OS to copy/move the file, so chmod'ing isn't required, but if it would be a linux machine or similar, changing permissions could be needed, as I know it depends on the configuration. ;]Are you sure??? i think that he needs to set the correct permissions to do that -ok, not chmod because it isn't a *nix machine- in windows this is done by opening the security tab of the properties window of the folder. To open this you use the alt+enter keyboard combination or right click the folder, select properties and then click the security tab, after that you must give to the correct user the write and modify permissions apart of the read/execute and list permission, i'm not pretty sure but this is needed if the HD was formated with NTFS.Best regards, Share this post Link to post Share on other sites
kuifjesjors 0 Report post Posted September 2, 2007 Why don't use coreFTP lite? Share this post Link to post Share on other sites
Sten 0 Report post Posted September 2, 2007 wots ftp got to do with it?i use coreFTP lite :blink:well you could use it to CHMOD the folders but u dont need any special type of FTP program to do that. Share this post Link to post Share on other sites