Uploading a local file to site FTP server using PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

I'm not sure why you are using a put. it seems like it should be a get.
what do you put in for the host? your server or the client? this is confusing...
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

move_upload

// should be like below if you ask me. 

@copy / copy()
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post by mjseaden »

I'm working on it - I'll post back if I manage to get the code working. It looks good so far...
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

mjseaden wrote: I think the problem is that what I'm asking it to do is in fact impossible - I don't think PHP can access the local machine's files in this way.
No, the problem is that you do not understand how the process works.

If your form based submission process is on the same server as where you are trying to transfer the file to by FTP (which from what I gather it is) then you don't require the FTP part of your script (unless you are running into permissions problems).

Once your form has been submitted THE FILES ARE ON YOUR SERVER. They are stored in a temporary directory. You then just need to move the files and all should be done.

The answer to your problem has already been given, as Wayne points out look at http://www.devnetwork.net/forums/viewtopic.php?t=19787 which shows a simple implementation of what you are trying to do.

You should forget about the FTP part as I don't see this as being required.
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post by mjseaden »

Despite the mild condescending tone you've helped explain it very well.

Thanks very much.
Post Reply