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:
  #1  
Old March 23rd, 2002, 06:21 PM
dado dado is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 34 dado User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 15 sec
Reputation Power: 7
File manipulation: File or Ftp functions?

I would like to know if it is good to use ftp connection (if the server allows) for users to upload,download and delete files, instead of file functions?

In my case, after passing authentication through DB, php script creates userīs directory using domain ftp connection where user can store and manipulate files (in my case only .zip files) with ftp_put, ftp_get and ftp_delete.
I made it this way simply because of security reasons because upload (copy) and delete (unlink) file functions need directory with chmod 777 to work but ftp functions works just fine with chmod 755!
As it is necessary login and password to open ftp connection I store them outside of root directory and they are included in main script.
My test page works fine but I would like to know can ftp file manipulation be used with various users in the same time ( probably stupid question but I have no experience in this field) , is it fast enough when there are many users and the traffic is high and generally comparation between ftp and file system manipulation?
Like this, Ftp seems more secure then file functions.

One question more!
I use headers for download files displayed through loop but if I want to download directly from the link I canīt do it if the file name has spaces!?
For example:

PHP Code:
 $handle=opendir('path'); 
while ((
$file readdir($handle))!== false){ 
    if (
$file != "." && $file != ".." && $file !=".htaccess") { 
        echo
"<tr><td>";
        echo 
"<a href="path/".$file> $file </a>\n"
        echo
"</td></tr>";
    } 
}
closedir($handle); 


If $file is "picture.zip" no problem, it downloads like http://www.domain.com/user/picture.zip but if the file is "my picture.zip", download fails because the link is http://www.domain.com/user/my !?

Thanks in advance

Last edited by dado : March 23rd, 2002 at 08:23 PM.

Reply With Quote
  #2  
Old March 23rd, 2002, 09:05 PM
Fataqui Fataqui is offline
Senior Member
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Nov 2001
Location: Boston Ma.
Posts: 1,530 Fataqui User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 42 sec
Reputation Power: 0
Hi


encode your $file, to fill in the empty string...

OLD FILE

My Little Red Book .txt


ENCODED FILE

My%20Little%20Red%20Book%20.txt


PHP Code:
<?php

$handle
=opendir('/www/uptown/local/images'); 
while ((
$file readdir($handle))!== false){ 
    if (
$file != "." && $file != ".." && $file !=".htaccess") {
        
$label rawurlencode($file);
        echo 
"<a href=/images/$label>$file</a><BR><BR>"
    } 
}
closedir($handle);

?>



F!

Reply With Quote
  #3  
Old March 24th, 2002, 03:13 AM
dado dado is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Posts: 34 dado User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 49 m 15 sec
Reputation Power: 7
Thanks Fataqui, I made mistake before and instead of rawurlencode I used urlencode and of course it didnīt work.
Now everything is all right.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > File manipulation: File or Ftp opinion?


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