|
|
|
|
![]() ![]() |
Aug 26 2007, 07:27 AM
Post
#1
|
|
|
Member [ Level 1 ] Group: [HOSTED] Posts: 44 Joined: 26-August 07 Member No.: 24,372 |
I thought there's no trouble with it. But it warned
CODE [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? CODE <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> |
|
|
|
Aug 26 2007, 09:29 AM
Post
#2
|
|
|
Absolute Newbie Group: Admin Posts: 888 Joined: 20-February 05 From: Indianapolis, Indiana, USA (Midwest) Member No.: 2,714 myCENTs:35.43 |
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 |
|
|
|
Aug 26 2007, 09:01 PM
Post
#3
|
|
|
Super Member Group: [HOSTED] Posts: 794 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:78.07 |
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, This post has been edited by TavoxPeru: Aug 26 2007, 09:03 PM |
|
|
|
Aug 27 2007, 12:56 AM
Post
#4
|
|
|
the Q Group: [HOSTED] Posts: 1,094 Joined: 13-July 05 From: Lithuania, Vilnius Member No.: 7,059 myCENTs:70.96 |
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. ;]
|
|
|
|
Aug 28 2007, 05:52 PM
Post
#5
|
|
|
Super Member Group: [HOSTED] Posts: 794 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:78.07 |
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, |
|
|
|
Sep 2 2007, 10:32 AM
Post
#6
|
|
|
Newbie [ Level 1 ] Group: Members Posts: 2 Joined: 2-September 07 Member No.: 24,554 |
Why don't use coreFTP lite?
|
|
|
|
Sep 2 2007, 11:23 AM
Post
#7
|
|
|
Oh come on Mrs. B! Group: Members Posts: 648 Joined: 6-June 07 From: Tasmania, Australia Member No.: 22,422 |
wots ftp got to do with it?
i use coreFTP lite well you could use it to CHMOD the folders but u dont need any special type of FTP program to do that. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 22nd November 2008 - 03:14 PM |