Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2001
    Location
    rules.php
    Posts
    272

    how to ftp upload a file from a string using php?

    Hi,

    I am building a file manager that works on one server(main server) and browsers another(file server) using php and the FTP functions. I am now trying make a section for creating passworded directories.

    I need to create an .htaccess and .htpasswd on the file server without creating a the files on the main server. how would i accomplish this?

    it would be perfect if there was a ftp_create_file but i dont think there is :-( any suggestions are welcome
    ...::: HOST APPROVAL :::...
    Web Hosting Directory
    http://www.hostapproval.com/
    http://www.hostapproval.com/hostadmin/add_your_host.php

  2. #2
    Join Date
    Aug 2002
    Location
    UK
    Posts
    13
    I think your best bet would be to create the two files on the main server, copy them accross to the FTP server and then delete them from the main server. I don't think there's another way of doing it other than that.
    Mark Carruth

  3. #3
    Join Date
    Jun 2001
    Location
    rules.php
    Posts
    272
    yeah thats what i thought...

    thanks
    ...::: HOST APPROVAL :::...
    Web Hosting Directory
    http://www.hostapproval.com/
    http://www.hostapproval.com/hostadmin/add_your_host.php

  4. #4

    +++untested+++

    (oops did i just disconnect modem users

    anyhow...


    i dont have time right now to see if this work, but fopen should be able to open a URL... have you tried

    Code:
    $fp=fopen('ftp://'.$username.':'.$password.'@'.$hostname.':'.$portnumber.'/path/to/file', 'w');
    fputs($fp, 'whatever?');
    fclose($fp);
    ??? just an offhand thought...

    (p.s. make sure you have appropriate write access via ftp before testing this...)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •