Computing.Net > Forums > Web Development > PHP Form + FTP upload

PHP Form + FTP upload

Reply to Message Icon

Original Message
Name: kyleinc
Date: January 16, 2005 at 17:18:21 Pacific
Subject: PHP Form + FTP upload
OS: FreeBSD
CPU/Ram: ?
Comment:

I am trying to write a form for a user to upload a file to a directory on my web server. I am connecting correctly and I can run other FTP commands, such as rename, but I am unable to upload. What can be the problem? My code is at http://www.spanimmersion.org/upload.txt


Report Offensive Message For Removal


Response Number 1
Name: Khalid
Date: January 16, 2005 at 23:27:55 Pacific
Subject: PHP Form + FTP upload
Reply: (edit)

If I look at the code, I have the idea something is missing, ie. the $submit-variable, I dont see where it is created but it is used in the beginning to determine the flow.

Same for $source_file, I do see you have named the form-element 'source-file', but that doesnt mean the file 'gets' into that variabele on his own...
$sourcefile = $_FILES['source_file']['tmp_name']
because file-uploads end up in the array $_FILES

Perhaps you should read [url]http://www.php.net/manual/en/features.file-upload.php[/url] first because I also miss the encoding type for the form because you are uploading a file:
(form method="POST" action="<?php echo $PHP_SELF?>" enctype="multipart/form-data")

good luck!


Report Offensive Follow Up For Removal

Response Number 2
Name: cubesoft
Date: January 17, 2005 at 07:36:18 Pacific
Subject: PHP Form + FTP upload
Reply: (edit)

You miss the multipart/form-data.

<form method="POST" action="<?php echo $PHP_SELF?>" enctype="multipart/form-data">


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: PHP Form + FTP upload

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 3 Days.
Discuss in The Lounge