FTP Code Problem

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

User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

I am trying to upload a file from my hard drive to a server
That's what the code I posted does.
No user is logged onto the server in my scenario.
My post included that
The $_SESSION var is the server subdirectore assigned to the logged in user, so just replace it with your desired server folder name.

Code: Select all

<input name="Ifile" type="file">
is what locates the file on your lcal hard drive. If you aren't able to adapt that to a filetype other than image then you are beyond any help I can offer you.
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

What you're trying to do is not possible, there is no special path to locate a file on the client. php runs on the server, it can't see the file on your hard drive. You need to upload it with a form first.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

Oh my. Did you actually read the post? The lower part of the post is is an html form, complete with <input> tags, <submit> buttons and everything. The upper part of the script is the script that runs if the form has been executed.

I would point out that this script has been functioning very well, online, for several years, so I have some problem with your contention that it is impossible.

I will admit that in removing some extraneous code I inadvertantly removed the closing </form> tag, but...
:?
hedge
Forum Contributor
Posts: 234
Joined: Fri Aug 30, 2002 10:19 am
Location: Calgary, AB, Canada

Post by hedge »

Bill H wrote:Oh my. Did you actually read the post? The lower part of the post is is an html form, complete with <input> tags, <submit> buttons and everything. The upper part of the script is the script that runs if the form has been executed.

I would point out that this script has been functioning very well, online, for several years, so I have some problem with your contention that it is impossible.

I will admit that in removing some extraneous code I inadvertantly removed the closing </form> tag, but...
:?
no BillH I wasn't saying what you were doing was impossible. He still thinks he can do this with just ftp functions, that's the part that's impossible. Sorry about that I should have quoted.
User avatar
Bill H
DevNet Resident
Posts: 1136
Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:

Post by Bill H »

Ah, hedge, my bad. Jumped to a conclusion.

One thing some programmers have trouble learning is that if one approach isn't working (in this case ftp functions), that a different approach (a file write) might be a solution. Seems like rather that using my approach he'd rather continue to hammer on the unsuccessful one.

Being something of an "old dog" (age 61) and programming since 1981, I don't hammer very long before I step back and consider taking a whole new approach to a problem. It makes life a whole lot easier. And the neat part is I keep learning new tricks, because I read these forums more than I post in them.
:)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Re: Reply

Post by twigletmac »

ffcyan wrote:I appreciate the code you have posted, but that is not what I want to do. I want to do what I previously mentioned. No user is logged onto the server in my scenario. Also, my files will XML files. Therefore your code would not be appropriate. I just need to know what the syntax is for locating a local file. Thank you.
Unfortunately just because you want to do something doesn't mean it's possible ;) . You definitely need file uploading otherwise you will not be able to do the rest of what you want.

Mac
Post Reply