Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uploading a file

Status
Not open for further replies.

mrfundeath

Programmer
Sep 5, 2001
12
US
I dont know whether its me or the hoster, but whenever i do copy($file,"file/directory");
i get an error that says
file "C:\directory\file.swf" could not be found in "server/directory" . Is it because my hoster won't allow me to upload files or is it because i did something wrong. I dont think i did anything wrong because i even took a sample script and it didnt work.
 
Do both parameters start at root and end with a file name?

copy("C:\directory\file.swf","/directory/filename.swf");
 
yea they both have root and filename.

the error says:

Warning: Unable to open 'C:\\file\\mymovie.swf' for reading: No such file or directory in /usr/home/e/v/eviltaco/public_html/upload.php on line 6

the php code i used (in case it helps) is:

if (isSet($upload))
copy($userfile, "/usr/home/e/v/eviltaco/public_html/filename.swf");
 
Those double-slashes are interesting... You're getting "unable to open" and if it's trying to open that double-slashed thing it's not going to have much luck. I'd try to figure out what's going on there first.

I'm stumped!
 
In php 4 bible it says that the double slashes are ok. It doesnt work even if i used stripslashes() and got single slashes!! I think its cause my hoster wont lemme upload files with php
 
Create a file called "phpinfo.php" and have it look just like this:

<?php
phpinfo();
?>

Put it anywhere and run it -- it'll give you a bunch of information about your server's configuration.

Find &quot;upload_max_filesize&quot; and see that it's not at zero or something. Don't worry if &quot;upload_tmp_dir&quot; is not defined, it defaults to the machine's temp directory. You also might find some interesting bits at the top, where it goes over the installation options.

I'll keep looking for you!
 
ok i fixed the prob! the form tag should have a ENCTYPE=&quot;multipart/form-data&quot; and the folder where I uploaded should have its chmod changed as well..
 
Oh cool glad you found it! Good to know that it will give you &quot;unable to open&quot; if you don't set the ENCTYPE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top