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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy() and FTP 1

Status
Not open for further replies.

Sleidia

Technical User
Joined
May 4, 2001
Messages
1,284
Location
FR

Hello,

I've moved on a new server that doesn't have root ftp enabled and I'm wondering if it is the reason why my PHP code for users uploads doesn't work anymore.
Is it related whatsoever? Directories are chmoded right. I don't get any error message but the file won't be copied on the server.

Thanks for the help!
 
Sleida,
Are file uploads enabled? Check the php.ini with phpinfo() or one of the scripts just posted to parse the ini file.
 
Hello DRJ478,

file_uploads is enabled (set to 1).
Does the copy command use the FTP protocol? FTP is disabled on my server. Do you think this could be the cause?
 
I don't think there is any FTP involved here. The copy command is to my knowledge based upon system calls.

Did the errorchecking level change from your previous host?
Try to find out where the file upload process fails.
 
When you said:

file_uploads is enabled (set to 1).

Is this in your program?
I don't know what server/system you're running.
From my experience with Unix/Linux, the file_upload is in the php.ini file, and look for variable file_upload, make sure it displays like:
; Whether to allow HTTP file uploads.
file_uploads = On
Hope this helps.



--
Mike FN
"8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Web Programmer."
 
Hello Mike :)

The PHP.ini is correct: file_uploads is set to "on" (it's displayed as "1" in phpinfo.php)

I still don't understand why uploading is impossible on my redhat server.

Here is the PHP code that works fine on Win98 and FreeBSD:

<?php

if($test_file != &quot;&quot;) {

$file_ext = str_replace(&quot;.&quot;, &quot;&quot;, strstr($test_file, '.'));

$updir = &quot;../my_pics/&quot;;
$file_name = &quot;my_test_file.&quot; . $file_ext;

@copy(&quot;$test_file&quot;, &quot;$updir/$file_name&quot;) or die (&quot;Couldn't upload the file.&quot;);

return;

} else {

}

?>

<form name=&quot;test_form&quot; method=&quot;POST&quot; action=&quot;test.php&quot;>
<input type=&quot;file&quot; name=&quot;test_file&quot;>
<input type=&quot;submit&quot; value=&quot; UPLOAD &quot;>
</form>

Thanks for your time !
 
Well sleipnir214, I have to admit that you are god himself ;)

I did what you said and the miracle occured!

The weird thing is that I've never had to use enctype neither on windows nor on freeBSD before. Is that specific to Redhat?

Anyway, many many thanks to you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top