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

FTP stupid question

Status
Not open for further replies.

daybase

Technical User
Joined
Dec 13, 2002
Messages
115
Location
GB
I'm on hour one of looking at using ftp functions instead of uploads and have numerous stupid questions but here's one that gors straight to the core.

Using examples from the PHP manual I am connecting fine, even changing directories but the upload just won't. I am defining variables:

<?php
$ftp_server="$ftp_user_name="mylogin";
$ftp_user_pass="mypass";
$destination_file="uploadfile.txt";
$source_file="a:\uploadfile.txt";
etc etc

then onto the important bit

$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);

I know I'm doing (or not doing) something very obvious and/or silly so be gentle with me - HELP!
 
Tempted to forget it altogether but in short simple terms I am looking for an alternative way to the standard form based PHP upload functions to transfer files from my PC to my ISP provided server. I have lifted code from the PHP manual asI usually do and inserted my own variables butI gather that there is more to FTP in terms of server requirements than for other FTP functions such as the need for FTP server on client and server apparently although PHP manual is strangely quiet on that subject.
 
The manual assumes you know a bit about FTP which you can find on the web. essentialy the remote computer has an FTP server on (like a web server) and the local machine has an FTP client, be it the onme at the windows command line or a gui one like ace ftp.
To transfer from the browser you can do several things depending on the platform, rangeing from:
A file field in a form (which you don't want to use I think)
You could encode the file into a hidden field and get it at the PHP side
You could use a component such as msxml which will allow you to PUT files on to a server.
Some of the above are platform specific and may require low security settings to opwn the file.
Finnaly you could write the ftp client in PHP, as php will run from the command prompt, but does require php to be insatlled locally.
To be honest with you use the file upload facility, PHP supports it well and it works.

 
I find the upload functions really good for individual files but I was really looking for a method of "bulk" uploading as my script is used for an Estate Agent property database - you know the usual I want a XXX bed XXX property in XXXXXXXX with a maximum price of £XXXXX.

Maintenance of the data based on our Access desktop system is pretty much a one-button operation but FTP ing the photo's is proving a bit daunting for the technophobes as sometimes the updates involve numerous jpg's .

Single properties is great using upload from a form although the form defaulting to the right directory would be useful but, i gather, it can't be done.
 
right, your using access so your on windows, get version 4 of msxml (its free) from the ms web site (older versions wil work). You can then add a button to your access application which calls msxml to do an http transfer which can be grabbed by a php script on the server side.
Yopu could gzip up the jpg's and send a one file and ungzip on the php side. I can show you some scrips to do it
Interesting about multiple uploads from the browser, you can do it with an array of file names(I think the manual chapter 18 shows) as it's just a form field you can send other stuff in the hidden fields to direct the php script.
I'm a bit confused when you say it can't be done, can you giv me an example for what you want to achieve here ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top