Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Php Uploading Problem
takashiro
post Aug 26 2007, 07:27 AM
Post #1


Member [ Level 1 ]
Group Icon

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>
Go to the top of the page
 
+Quote Post
vujsa
post Aug 26 2007, 09:29 AM
Post #2


Absolute Newbie
Group Icon

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.cool.gif

vujsa
Go to the top of the page
 
+Quote Post
TavoxPeru
post Aug 26 2007, 09:01 PM
Post #3


Super Member
Group Icon

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
Go to the top of the page
 
+Quote Post
Quatrux
post Aug 27 2007, 12:56 AM
Post #4


the Q
Group Icon

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. ;]
Go to the top of the page
 
+Quote Post
TavoxPeru
post Aug 28 2007, 05:52 PM
Post #5


Super Member
Group Icon

Group: [HOSTED]
Posts: 794
Joined: 8-April 06
From: Lima - Peru
Member No.: 12,579
myCENTs:78.07



QUOTE(Quatrux @ Aug 26 2007, 07:56 PM) *
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,
Go to the top of the page
 
+Quote Post
Sjors
post Sep 2 2007, 10:32 AM
Post #6


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 2
Joined: 2-September 07
Member No.: 24,554



Why don't use coreFTP lite?
Go to the top of the page
 
+Quote Post
Sten
post Sep 2 2007, 11:23 AM
Post #7


Oh come on Mrs. B!
Group Icon

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 biggrin.gif

well you could use it to CHMOD the folders but u dont need any special type of FTP program to do that.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Help! Problem With My Flash-Drive(2)
  2. Error 406 - Problem In My Phpbb Forum(8)
  3. MSN Help(5)
  4. Problem: I Need Urgent Help. Can't Boot.(9)
  5. Uploading Image File Through JSP Code To Server(9)
  6. ATI Video Card Problem! Need Help(5)
  7. Problem Accessing My Cpanel(9)
  8. Einstein Quiz(30)
  9. XP Problem: Clicking On Folder Opens Search(4)
  10. Photoshop Cropping Problem(7)
  11. Need To Hack An Admin Account On Xp... No Problem!(61)
  12. Blue Screen - irql_not_less_or_equal(35)
  13. Spam Problem On My Forums(26)
  14. Frustrating Problem With XP On Laptop(20)
  15. Problem With Drag And Drop (or So It Seems).(12)
  1. Win Rar Password Problem(7)
  2. Internet Explorer 7 Problem(8)
  3. Fedora Core 6 Install Problem(6)
  4. Trojan / Virus Problem ,please Help(18)
  5. A Gaiaonline Problem(9)
  6. Administrator Account Problem In Microsoft Xp [solved](20)
  7. Uploading More Than 30 Files In Less Than 10 Clicks?(5)
  8. Problem With Move_uploaded_file()(5)
  9. Problem With Div's In Ie6 And Lower(4)
  10. Pc Problem(8)
  11. Graphics Driver Out...(2)
  12. Problem Setting Up Wireless Internet & Wireless Nintendo Wii(4)
  13. System Is Crashed - Hardware Problem(3)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 03:14 PM