Page 1 of 1
Using ftp functions to upload a file
Posted: Wed Jul 12, 2006 3:26 pm
by HiddenS3crets
I need to create a file upload script so people can upload files from their computer to my server, but I cannot use $_FILES because move_uploaded_file() violates the safe mode restrictions, so I need to use ftp functions instead to upload it. I've tried using ftp_put(), but it isn't working.
Is ftp_put() the right function to use? The source code i've looked at from various tutorials has provided no help. Possibly one of you could?

Posted: Wed Jul 12, 2006 3:37 pm
by Burrito
the ftp functions will not work in your situation. They are to upload / download files from the server to another, ftp server. If you need to allow people to upload files from their machines to your server, then you're going to have to use the $_FILES[] array if you plan to do it via HTML. Other options would include writing something in flash or java that would allow for uploading files.
Posted: Wed Jul 12, 2006 3:41 pm
by HiddenS3crets
Damn, thought so... The problem is that I can't use $_FILES because of the safe mode restrictions. I cannot turn it off because I don't host my own server, thus I can't restart Apache to save the safe mode settings.
I don't think there's another way to turn it off. I also tried putting in the .htaccess file this line:
php_admin_flags safe_mode off
But then I just get Internal Server Errors on any pages in the directory with the .htaccess file.
Do you know of any other way to turn off safe mode?
Posted: Wed Jul 12, 2006 3:41 pm
by Luke
usually you can ask your host to do that for you.