SunQuest
           FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 29th, 2003, 01:52 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 4 m 26 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Arrow Upload multiple files using FTP

Hi,

I know this has been covered a lot in these forums, but I just can't seem to crack this one.

I have got a very simple FTP interface written on my website, working very nicely, but I am now trying to add multiple file upload. I don't to upload directories, just say 5 files at a time.

Anyway, I have some code for deleting multiple files, which works, but I can't seem to get it to work with uploads. Any pointers appreciated.

First snip: multiple delete:

PHP Code:
elseif ($_POST['action'] == "Delete"):
ftp_chdir($result$_POST['cdir']);
// loop through selected files and delete
for ($x=0$x<sizeof($_POST['dfile']); $x++):
$res_code = @ftp_delete($result$_POST['cdir'] . "/" $_POST['dfile'][$x]);
endfor;
// check status and display
if ($res_code == 1):
$status "<span class=\"red\">Deletion successful!</span>";
else:
$status "<span class=\"red\">Deletion error!</span>";
endif; 

Then the original upload file script:
PHP Code:
elseif ($_POST['action'] == "Upload"):
ftp_chdir($result$_POST['cdir']);
$res_code = @ftp_put($result$_FILES['upfile']['name'], $_FILES['upfile']['tmp_name'], FTP_BINARY);
// check status and display
if ($res_code == 1):
$status "<span class=\"red\">Upload successful!</span>";
else:
$status "<span class=\"red\">Upload error!</span>";
endif;
endif; 

Then essentially the same script, but trying to upload mulitple files:
PHP Code:
elseif ($_POST['action'] == "Upload"):
ftp_chdir($result$_POST['cdir']);
for (
$x=0$x<sizeof($_POST['upfile']); $x++):
$res_code ftp_put($result$_FILES['upfile']['name'][$x], $_FILES['upfile']['tmp_name'][$x], FTP_BINARY);
endfor;
// check status and display
if ($res_code == 1):
$status "<span class=\"red\">Upload successful!</span>";
else:
$status "<span class=\"red\">Upload error!</span>";
endif;
endif; 

Even without the @, it still only prints Upload error!
Thanks
Jamie
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

# Any form of employment is strictly prohibited ......


__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.

__________________

Last edited by jabba_29 : October 29th, 2003 at 01:56 PM.

Reply With Quote
  #2  
Old October 29th, 2003, 02:24 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 4 m 26 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Lightbulb

Talking to myself again

I have partially solved this:

PHP Code:
for ($x=0$x<sizeof($_FILES['upfile']); $x++):
$res_code = @ftp_put($result$_FILES['upfile']['name'][$x], $_FILES['upfile']['tmp_name'][$x], FTP_BINARY);
endfor;

// check status and display

if ($res_code == 1):
$status "<span class=\"red\">Upload successful!</span>";
else:
$status "<span class=\"red\">Upload error!</span>";
endif;

endif; 


Mulitple files are uploaded, but I get upload error message - any ideas

Reply With Quote
  #3  
Old October 29th, 2003, 02:33 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,670 jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 10th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 6 h 4 m 26 sec
Reputation Power: 1618
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
And again

The error is only happening if not every upfile[] is used, for example 3 images instead of 5.


Just fixed that problem too as I was trying, though this is probably incorrect ! Upload code for those interested:

PHP Code:
// action: upload file

elseif ($_POST['action'] == "Upload"):
ftp_chdir($result$_POST['cdir']);

for (
$x=0$x<sizeof($_FILES['upfile']); $x++):
$res_code .= @ftp_put($result$_FILES['upfile']['name'][$x], $_FILES['upfile']['tmp_name'][$x], FTP_BINARY);
endfor;

// check status and display

if ($res_code 0):
$status "<span class=\"red\">Upload successful!</span>";
else:
$status "<span class=\"red\">Upload error!</span>";
endif;

endif; 


I think I will go and carry on my conversation with myself somewhere else now

Br

Jamie

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > Upload multiple files using FTP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway